1.创建临时表
create table test_view as select * from test where date(to_timestamp(endtime))>='2012-09-02';
2.导出临时表数据为文本
copy test_view to '/home/postgres/test_view.txt' with delimiter as '|';
3.导入文件数据到数据库中指定表
delete from test;
copy test from '/home/postgres/test_view.txt' with delimiter as '|';
本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/986618