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 '|';