导出
[quote]
pg_dump -U user database -t tablename -f dump.sql
[/quote]
导入
[quote]
createdb -U user database
psql -U user -d database -f dump.sql
[/quote]
从文件中load,已tab分割,如果是其他分割可以加上with delimiter子句
[quote]
cat /tmp/b | psql -U username -d database -c "copy hotelfts_specialcase(key,value,status,operator,operate_at) from STDIN
[/quote]
到处tab分割的文本
[quote]
psql -U username -d db -h host -c "copy (select cityname_zh,cityname_en from citys where belongtocountry!='China') to STDOUT"
[/quote]
导出CSV格式
[quote]
psql -U username -d db -h host -c "\copy (select cityname_zh,cityname_en from citys where belongtocountry!='China') to citys.result1 with csv header"
[/quote]
[quote]
pg_dump -U user database -t tablename -f dump.sql
[/quote]
导入
[quote]
createdb -U user database
psql -U user -d database -f dump.sql
[/quote]
从文件中load,已tab分割,如果是其他分割可以加上with delimiter子句
[quote]
cat /tmp/b | psql -U username -d database -c "copy hotelfts_specialcase(key,value,status,operator,operate_at) from STDIN
[/quote]
到处tab分割的文本
[quote]
psql -U username -d db -h host -c "copy (select cityname_zh,cityname_en from citys where belongtocountry!='China') to STDOUT"
[/quote]
导出CSV格式
[quote]
psql -U username -d db -h host -c "\copy (select cityname_zh,cityname_en from citys where belongtocountry!='China') to citys.result1 with csv header"
[/quote]