Export Postgres Database into CSV file

后端 未结 7 1968
醉梦人生
醉梦人生 2021-01-29 23:11

I want to export a Postgres database into a CSV file. Is this possible?

If it is possible, then how can I do this? I have seen that we can convert a particular table into

7条回答
  •  太阳男子
    2021-01-29 23:50

    If you want to specify the database and user while exporting you can just modify the answer given by Piotr as follows

    psql -P format=unaligned -P tuples_only -P fieldsep=\, -c "select * from tableName" > tableName_exp.csv -U  -d 
    

提交回复
热议问题