BUG #7709: psql \copy csv terminates with \. in quoted region

From: tgarnett(at)panjiva(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #7709: psql \copy csv terminates with \. in quoted region
Date: 2012-11-27 15:55:28
Message-ID: E1TdNVQ-0001ju-GO@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 7709
Logged by: Timothy Garnett
Email address: tgarnett(at)panjiva(dot)com
PostgreSQL version: 9.1.2
Operating system: Ubuntu 10.04.4 LTS
Description:

psql \copy terminates at \. by itself in a line even if the format is csv
and the \. is inside a quoted region. This means that some values can't be
round-tripped by psql \copy. Tested and the native postgresql COPY handles
this case correctly.

Ex:
=# CREATE TEMPORARY TABLE test_table AS (SELECT 1 AS id, '
\.
'::text AS data, 2 AS num_data);
=# \copy test_table to '/tmp/dummy.csv' csv
=# TRUNCATE TABLE test_table;
=# \copy test_table from '/tmp/dummy.csv' csv
ERROR: unterminated CSV quoted field
CONTEXT: COPY test_table, line 1: "1,"
"

(postgresql COPY can handle this case though:
=# COPY test_table TO '/tmp/TEST_DATA.csv' WITH (FORMAT CSV);
=# TRUNCATE TABLE test_table;
=# COPY test_table FROM '/tmp/TEST_DATA.csv' WITH (FORMAT CSV);
works fine)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-11-27 17:33:44 Re: BUG #7709: psql \copy csv terminates with \. in quoted region
Previous Message Maxim Boguk 2012-11-27 00:14:40 Re: BUG #7703: Error with partitioning with distinct over aggregate