Or in psql you can look at the help (\?) and set the output format to unaligned, comma separated, and output the table
todisk :
database=> \pset fieldsep ,
Field separator is ",".
database=> \a
Output format is unaligned.
database=> \o table.csv
database=> SELECT * FROM table;
database=> \o
cheers
Ben
On 05/10/2010, at 6:59 AM, Wang, Mary Y wrote:
> Hi All,
>
> I'd like to do a data dump of a table to a CSV or XML file.
> How would I do that?
>
> I'm running on Postgres 8.3.8.
>
> Thanks in advance.
> Mary Wang
>
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general