From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: vivek4422@gmail.com
Subject: BUG #16424: COPY Command fails for CSV formath
Date: Fri, 08 May 2020 07:42:23 +0000
Message-ID: <16424-e8b18e8aa3bbd0c8@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16424
Logged by: Vivek Kamath
Email address: vivek4422@gmail.com
PostgreSQL version: 10.6
Operating system: Linux Unix
Description:
Hi,
I am copying a csv file where the fields are quoted with " and separated by
,.
I am using below syntax to copy data using below syntax
psql -c "COPY table_name from filename WITH (FORMAT csv)".
On Analysis I observed that any data that even number of double quotes in it
are copied successfully but fails when it has odd number of double quotes in
it.
For ex
1234,"Test "hi" ","Test bye" will be loaded as 1234,Test hi, Test bye in
table successfully but my expectation is to load data as 1234,Test "hi",
Test bye
where as
1234,"Test "hi ", "Test bye" will fail with error ERROR: unterminated CSV
quoted field.. In this case my expectation is to load data as 1234,Test "hi,
Test bye.
Also since all this is is happening as part of the batch. I cannot
pre-process the data as the same data set needs to be loaded in Redshift DB.
Copy command works perfectly fine with this data set in redshift.
Idea is load whatever comes in between the double quotes ("......") as is in
varchar field.
Please suggest some ideas as how this can be achieved.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, vivek4422@gmail.com
Subject: Re: BUG #16424: COPY Command fails for CSV formath
In-Reply-To: <16424-e8b18e8aa3bbd0c8@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox