在postgres上将表导出到CSV [英] export table to csv on postgres
本文介绍了在postgres上将表导出到CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我不是超级用户并且无法使用副本$时,如何在Postgres中将表导出到
.csv
c $ c>命令?
How can I export a table to .csv
in Postgres, when I'm not superuser and can't use the copy
command?
我仍然可以通过右键单击导入按钮将数据导入postgres,但没有导出选项。
I can still import the data to postgres with "import" button on the right click, but no export option.
推荐答案
使用psql并将流重定向到文件:
Use psql and redirect stream to file:
psql -U <USER> -d <DB_NAME> -c "COPY <YOUR_TABLE> TO stdout DELIMITER ',' CSV HEADER;" > file.csv
这篇关于在postgres上将表导出到CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文