export table to csv on postgres

前端 未结 5 1202
甜味超标
甜味超标 2021-02-05 13:56

How can I export a table to .csv in Postgres, when I\'m not superuser and can\'t use the copy command?

I can still import the data to postgres

5条回答
  •  孤街浪徒
    2021-02-05 14:56

    I was having trouble with superuser and running psql, I took the simple stupid way using PGAdmin III.
    1) SELECT * FROM ;
    Before running select Query in the menu bar and select 'Query to File' This will save it to a folder of your choice. May have to play with the settings on how to export, it likes quoting and ;.

    2) SELECT * FROM ;
    run normally and then save the output by selecting export in the File menu. This will save as a .csv

    This is not a good approach for large tables. Tables I have done this for are a few 100,000 rows and 10-30 columns. Large tables may have problems.

提交回复
热议问题