/ Published in: Other

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
\f ',' \a \t \o /tmp/moocow.csv SELECT foo,bar FROM whatever; \o \q If a field has newlines, this will break. You can do something like this instead..... SELECT foo, bar, '"' || REPLACE(REPLACE(field_with_newilne, '\n', '\\n'), '"', '""') || '"' FROM whatever;
URL: http://pookey.co.uk/blog/archives/49-Outputting-from-Postgres-to-CSV.html
Comments
