generate CSV with Copy+Quotes - Postgres 9.2

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: generate CSV with Copy+Quotes - Postgres 9.2
Date: 2016-09-21 09:23:20
Message-ID: CAJNY3itoGeMk_t-Wj7orG1VLm3SunMCHvg3AkvCBGpwJr5ckXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys,

I'm exporting some data for testing purpose.

COPY (SELECT
> name_first
> name_last,
> email,
> company
> FROM
> clients
> )
> TO '/var/lib/pgsql/test1.csv' DELIMITER ',' csv HEADER QUOTE '"';

cat /var/lib/pgsql/test1.csv

"","",hiddenemail(at)hotmail(dot)com,"",John Wayne

See how the email and the company aren't into two "?

*What I need is:*

> "","","hiddenemail(at)hotmail(dot)com","","John Wayne"

I thought that by putting QUOTE the COPY would do that?

Is there any way I can put the " into those fields?

Cheers

Patrick

Responses

Browse pgsql-general by date

  From Date Subject
Next Message kbrannen 2016-09-21 12:39:30 Re: overwrite column data select - Postgres 9.2
Previous Message Patrick B 2016-09-21 09:16:16 Re: overwrite column data select - Postgres 9.2