Export Postgres Database into CSV file

后端 未结 7 1951
醉梦人生
醉梦人生 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 <USER> -d <DB_NAME>
    
    0 讨论(0)
提交回复
热议问题