pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tgarnett@panjiva.com
To: pgsql-bugs@postgresql.org
Subject: BUG #7709: psql \copy csv terminates with \. in quoted region
Date: Tue, 27 Nov 2012 15:55:28 +0000
Message-ID: <E1TdNVQ-0001ju-GO@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      7709
Logged by:          Timothy Garnett
Email address:      tgarnett@panjiva.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)



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)  latest in thread

Message-ID: <E1TdNVQ-0001ju-GO@wrigleys.postgresql.org>
Permalink:  ../E1TdNVQ-0001ju-GO@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1TdNVQ-0001ju-GO@wrigleys.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgarnett@panjiva.com
  Subject: Re: BUG #7709: psql \copy csv terminates with \. in quoted region
  In-Reply-To: <E1TdNVQ-0001ju-GO@wrigleys.postgresql.org>
  References: <E1TdNVQ-0001ju-GO@wrigleys.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