Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdNtP-0001fT-Co for pgsql-bugs@arkaria.postgresql.org; Tue, 27 Nov 2012 16:20:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TdNtO-0005ao-BP for pgsql-bugs@arkaria.postgresql.org; Tue, 27 Nov 2012 16:20:14 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdNVW-0006Xl-7j for pgsql-bugs@postgresql.org; Tue, 27 Nov 2012 15:55:34 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdNVS-0003vC-LE for pgsql-bugs@postgresql.org; Tue, 27 Nov 2012 15:55:33 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TdNVQ-0001Ac-S6 for pgsql-bugs@postgresql.org; Tue, 27 Nov 2012 15:55:29 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1TdNVQ-0001ju-GO for pgsql-bugs@postgresql.org; Tue, 27 Nov 2012 15:55:28 +0000 Date: Tue, 27 Nov 2012 15:55:28 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7709: psql \copy csv terminates with \. in quoted region To: pgsql-bugs@postgresql.org From: tgarnett@panjiva.com X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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:=20=20=20=20=20=20=20=20 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: =3D# CREATE TEMPORARY TABLE test_table AS (SELECT 1 AS id, ' \. '::text AS data, 2 AS num_data); =3D# \copy test_table to '/tmp/dummy.csv' csv =3D# TRUNCATE TABLE test_table; =3D# \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: =3D# COPY test_table TO '/tmp/TEST_DATA.csv' WITH (FORMAT CSV); =3D# TRUNCATE TABLE test_table; =3D# COPY test_table FROM '/tmp/TEST_DATA.csv' WITH (FORMAT CSV); works fine) --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs