From c7fc2ccf63f054ac60bde739077fbcfb5f86de69 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 28 Dec 2005 05:38:27 +0000 Subject: Add regression tests for CSV and \., and add automatic quoting of a single column dump that has a \. value, so the load works properly. I also added documentation describing this issue. Backpatch to 8.1.X. --- doc/src/sgml/ref/copy.sgml | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 2d8dc945716..18f0cc87b6d 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -1,5 +1,5 @@ @@ -511,17 +511,28 @@ COPY tablename [ ( + + Because backslash is not a special character in the CSV + format, \., the end-of-data marker, could also appear + as a data value. To avoid any misinterpretation, a \. + data value appearing as a lone entry on a line is automatically + quoted on output, and on input, if quoted, is not interpreted as the + end-of-data marker. If you are loading a single-column table that + might have a column value of \., you might need to quote + that value in the input file. + + - - In CSV mode, all characters are significant. A quoted value - surrounded by white space, or any characters other than - DELIMITER, will include those characters. This can cause - errors if you import data from a system that pads CSV - lines with white space out to some fixed width. If such a situation - arises you might need to preprocess the CSV file to remove - the trailing white space, before importing the data into - PostgreSQL. - + + In CSV mode, all characters are significant. A quoted value + surrounded by white space, or any characters other than + DELIMITER, will include those characters. This can cause + errors if you import data from a system that pads CSV + lines with white space out to some fixed width. If such a situation + arises you might need to preprocess the CSV file to remove + the trailing white space, before importing the data into + PostgreSQL. + -- cgit v1.2.3