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.Elphick@lfix.co.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