[clue-tech] postgres CSV export with headers

erik at ezolan.com erik at ezolan.com
Wed Dec 13 15:31:35 MST 2006


> psql foo -c "begin; create table blah as select * from my_summary
> order by provider, period_end; copy  blah to '/tmp/blah.csv' CSV;
> rollback "

I looked up the copy command on the postgresql website. It shows a
"HEADER" option you can use with CSV.

I don't have access to a working postgresql database here at work so I
can't play with it and give you the correct command. Is this what you're
looking for, or did I read your request wrong?

BTW, google was useless for this. Geez! There are more 3rd party apps
for massaging data than you can shake a stick at.

Erik Z





More information about the clue-tech mailing list