[pgsql] pgsql export to csv

To export PostgreSQL data to csv file using psql interactive terminal.

open terminal
su postgres
psql <db_name>
\f ','
\a
\t
\o outputfile.csv
select ..... (your sql select statement)
\o
\q


Additional notes: If you want a TAB delimited file instead of comma, use \f 'Ctrl-V TAB'. \f sets the field separator. \a echo all. \t tuples(rows) only. \q quit.

PageRank
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by ⓒ쟁이™

2008/10/31 18:38 2008/10/31 18:38
, ,
Response
No Trackback , No Comment
RSS :
http://funix.net/rss/response/32


Archives

106

66

-14 days

today : 10

Creative Commons License

이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.