Re: generate CSV with Copy+Quotes - Postgres 9.2

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: generate CSV with Copy+Quotes - Postgres 9.2
Date: 2016-09-21 20:11:42
Message-ID: CAJNY3iuHE6v7nO=z9QZFzKO-j+LSZWutPUU1KHVbHMKBQhAxgw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
>
>>
>
> Perhaps you mean you want to quote of all strings? For that you use FORCE
> QUOTE.
> eg:
> COPY (SELECT
> name_first
> name_last,
> email,
> company
> FROM
> clients
> )
> TO '/var/lib/pgsql/test1.csv' DELIMITER ','
> csv HEADER QUOTE '"';
> FORCE QUOTE name_first, name_last, email, company;
>
> Please RTFM
> *https://www.postgresql.org/docs/9.4/static/sql-copy.html
> <https://www.postgresql.org/docs/9.4/static/sql-copy.html>*
> --
>

>

Thanks! FORCE QUOTE was exactly what I needed.

Patrick.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2016-09-21 20:27:08 Re: PgSQL versions supported on ubuntu 16 and debian 8
Previous Message John R Pierce 2016-09-21 20:06:46 Re: PgSQL versions supported on ubuntu 16 and debian 8