1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

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.
This commit is contained in:
Bruce Momjian
2005-12-28 05:38:27 +00:00
parent 3f99c2d5a7
commit c7fc2ccf63
4 changed files with 61 additions and 25 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/copy.sgml,v 1.70 2005/10/15 20:12:33 neilc Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/copy.sgml,v 1.70.2.1 2005/12/28 05:38:26 momjian Exp $
PostgreSQL documentation
-->
@ -511,17 +511,28 @@ COPY <replaceable class="parameter">tablename</replaceable> [ ( <replaceable cla
comparisons for specific columns.
</para>
<para>
Because backslash is not a special character in the <literal>CSV</>
format, <literal>\.</>, the end-of-data marker, could also appear
as a data value. To avoid any misinterpretation, a <literal>\.</>
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 <literal>\.</>, you might need to quote
that value in the input file.
</para>
<note>
<para>
In <literal>CSV</> mode, all characters are significant. A quoted value
surrounded by white space, or any characters other than
<literal>DELIMITER</>, will include those characters. This can cause
errors if you import data from a system that pads <literal>CSV</>
lines with white space out to some fixed width. If such a situation
arises you might need to preprocess the <literal>CSV</> file to remove
the trailing white space, before importing the data into
<productname>PostgreSQL</>.
</para>
<para>
In <literal>CSV</> mode, all characters are significant. A quoted value
surrounded by white space, or any characters other than
<literal>DELIMITER</>, will include those characters. This can cause
errors if you import data from a system that pads <literal>CSV</>
lines with white space out to some fixed width. If such a situation
arises you might need to preprocess the <literal>CSV</> file to remove
the trailing white space, before importing the data into
<productname>PostgreSQL</>.
</para>
</note>
<note>