coffee_cn

博客园 首页 新随笔 联系 订阅 管理

红色部分的三条命令完成把结果集输出到文件!!

[root@test root]# psql -hlocalhost -Utest test
Welcome to psql 8.0.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

gudumami=# \f ,
Field separator is ",".
gudumami=# \o /tmp/test.csv
gudumami=# SELECT * WHERE test ORDER BY id;
gudumami=# \q

posted on 2009-11-20 15:05  coffee  阅读(639)  评论(0)    收藏  举报