From: | Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | COPY incorrectly uses null instead of an empty string in last field |
Date: | 2002-02-26 16:41:38 |
Message-ID: | 1014741700.5762.233.camel@linda |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Release 7.2:
Where the last field of a line contains an empty string, COPY
incorrectly inserts a NULL. This will cause data to be loaded
incorrectly from pg_dump. This happens because, when a newline is seen,
COPY needs to know whether there was a preceding delimiter and use an
empty string in that case; there is a difference between a last field
that is an empty string and one or more last fields that are completely
unspecified.
Changing this should not affect COPY TO or pg_dump, which already put
out \N in the last field if it really is NULL.
For example:
--
-- Selected TOC Entries:
--
\connect - "olly"
--
-- TOC Entry ID 2 (OID 1522144)
--
-- Name: schau Type: TABLE Owner: olly
--
CREATE TABLE "schau" (
"feld1" text NOT NULL,
"feld2" character varying(10) NOT NULL,
Constraint "pk_schau" Primary Key ("feld1", "feld2")
);
--
-- Data for TOC Entry ID 3 (OID 1522144)
--
-- Name: schau Type: TABLE DATA Owner: olly
--
COPY "schau" FROM stdin;
Helge
Arne
Alle Keiner
\.
I tried to make a fix, but managed to break it completely :-(
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
"But God commendeth his love toward us, in that, while
we were yet sinners, Christ died for us."
Romans 5:8
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Lockhart | 2002-02-26 16:44:42 | Re: quotes in SET grammar |
Previous Message | Darcy Buskermolen | 2002-02-26 16:30:01 | Re: COPY FROM is not 8bit clean |