Skip to content

psql --csv flag mention #9

@kmoppel

Description

@kmoppel

Maybe woth mentioning in the README that psql for some time already also has a basic support for CSV output via the --csv flag. Can't change the delimiter and custom quoting settings though, for that need to use the COPY.

Postgres docs

$ psql --csv -Xc "select * from pgbench_accounts limit 2"
aid,bid,abalance,filler
1,1,0,                                                                                    
2,1,0,
$ psql -Xc "COPY (select * from pgbench_accounts limit 2) TO stdout WITH ( format csv, delimiter ';', header on)"
aid;bid;abalance;filler
1;1;0;                                                                                    
2;1;0;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions