BUG #2221: Bad delimiters allowed in COPY ... TO

From: "David Fetter" <david(at)fetter(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2221: Bad delimiters allowed in COPY ... TO
Date: 2006-01-29 21:50:08
Message-ID: 20060129215008.A5965F0B00@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches


The following bug has been logged online:

Bug reference: 2221
Logged by: David Fetter
Email address: david(at)fetter(dot)org
PostgreSQL version: all
Operating system: all
Description: Bad delimiters allowed in COPY ... TO
Details:

This came up while I was testing my pg_dump "specify DELIMITER AS and/or
NULL AS" patch.

Below is a repro using newline. A similar problem happens when you specify
the delimiter as a backslash. Should COPY simply not allow these
delimiters? What about carriage return? Just in general, what bytes other
than null ought COPY to reject out of hand?

Also, what regression tests do we want to put in in order to ensure that
COPY ... TO generates output that COPY ... FROM can understand?

CREATE TABLE pqxxevents (
"year" integer,
event text
);

COPY pqxxevents ("year", event) FROM stdin DELIMITER AS '^M';
2010^MOdyssey Two
2038^Mtime_t overflow
1971^Mjtv
1981^MC:\\>
1997^MAsian crisis
1999^M\N
1978^Mbloody\t\tcold
1989^MOde an die Freiheit
2001^MNew millennium
2001^M'911' WTC attack
2001^MA Space Odyssey
2002^Mlibpqxx
3001^MFinal Odyssey
\.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Fetter 2006-01-30 00:41:43 Re: BUG #2221: Bad delimiters allowed in COPY ... TO
Previous Message Tom Lane 2006-01-29 20:14:59 Re: BUG #2218: Variables selected in VIEWs under different names break queries using those views

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2006-01-30 00:41:43 Re: BUG #2221: Bad delimiters allowed in COPY ... TO
Previous Message Mark Woodward 2006-01-29 20:15:06 Re: Want to add to contrib.... xmldbx