postgres 导出数据到csv 文件


copy ( select * from ztetdcellpm_3_201309) to '/home/wff/ztetdcellpm_3_201309.csv' with csv header

在postgres 客户端,之前都是很土鳖的 先select 出来,然后再点工具栏的导出按钮的。现在终于不用这样了。但是这个sql 执行的时候要确定,postgres要输出的文件路径是否有读写权限。

还有就是看到网上有人说到编码方式了,这个等会再确认下。

本地 show client_encoding 是unicode格式的。

 

posted @ 2014-02-26 17:56  junfantasy  Views(2439)  Comments(0)    收藏  举报