COPY allows DELIMITER and NULL to be specified which don't allow the data
to be copied back in properly.  Using any delimiter that could be part of
a backslash escape sequence (\n \0 \t) will break if any of the data has a
character matching the delimiter because it will be escaped and then be
read as a special character.

It also allows DELIMITER and NULL to overlap.  No character in the NULL
specification should be the DELIMITER.

Kris Jurka
DROP TABLE copytest;

CREATE TABLE copytest (a text, b text);

INSERT INTO copytest VALUES ('t,n,g','a');
INSERT INTO copytest VALUES (NULL,NULL);

COPY copytest TO STDOUT WITH DELIMITER 'n' NULL 'n';
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to