Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-bugs by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group