Created
September 3, 2014 03:55
-
-
Save itomg/b659b8a159e5a29b6040 to your computer and use it in GitHub Desktop.
PostgreSQL 导出导入表中指定查询数据
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psql: | |
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 '|'; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment