|
1 | 1 | <!--
|
2 |
| -$PostgreSQL: pgsql/doc/src/sgml/ref/copy.sgml,v 1.58 2004/11/15 06:32:15 neilc Exp $ |
| 2 | +$PostgreSQL: pgsql/doc/src/sgml/ref/copy.sgml,v 1.59 2004/11/17 02:50:06 neilc Exp $ |
3 | 3 | PostgreSQL documentation
|
4 | 4 | -->
|
5 | 5 |
|
@@ -433,13 +433,13 @@ COPY <replaceable class="parameter">tablename</replaceable> [ ( <replaceable cla
|
433 | 433 | </para>
|
434 | 434 |
|
435 | 435 | <para>
|
436 |
| - It is strongly recommended that applications generating COPY data convert |
| 436 | + It is strongly recommended that applications generating <command>COPY</command> data convert |
437 | 437 | data newlines and carriage returns to the <literal>\n</> and
|
438 | 438 | <literal>\r</> sequences respectively. At present it is
|
439 | 439 | possible to represent a data carriage return by a backslash and carriage
|
440 | 440 | return, and to represent a data newline by a backslash and newline.
|
441 | 441 | However, these representations might not be accepted in future releases.
|
442 |
| - They are also highly vulnerable to corruption if the COPY file is |
| 442 | + They are also highly vulnerable to corruption if the <command>COPY</command> file is |
443 | 443 | transferred across different machines (for example, from Unix to Windows
|
444 | 444 | or vice versa).
|
445 | 445 | </para>
|
@@ -484,23 +484,29 @@ COPY <replaceable class="parameter">tablename</replaceable> [ ( <replaceable cla
|
484 | 484 |
|
485 | 485 | <para>
|
486 | 486 | In general, the <literal>CSV</> format has no way to distinguish a
|
487 |
| - <literal>NULL</> from an empty string. |
488 |
| - <productname>PostgreSQL</productname>'s COPY handles this by |
489 |
| - quoting. A <literal>NULL</> is output as the <literal>NULL</> string |
490 |
| - and is not quoted, while a data value matching the <literal>NULL</> string |
491 |
| - is quoted. Therefore, using the default settings, a <literal>NULL</> is |
492 |
| - written as an unquoted empty string, while an empty string is |
493 |
| - written with double quotes (<literal>""</>). Reading values follows |
494 |
| - similar rules. You can use <literal>FORCE NOT NULL</> to prevent <literal>NULL</> |
495 |
| - input comparisons for specific columns. |
| 487 | + <literal>NULL</> value from an empty string. |
| 488 | + <productname>PostgreSQL</>'s <command>COPY</> handles this by |
| 489 | + quoting. A <literal>NULL</> is output as the <literal>NULL</> |
| 490 | + string and is not quoted, while a data value matching the |
| 491 | + <literal>NULL</> string is quoted. Therefore, using the default |
| 492 | + settings, a <literal>NULL</> is written as an unquoted empty |
| 493 | + string, while an empty string is written with double quotes |
| 494 | + (<literal>""</>). Reading values follows similar rules. You can |
| 495 | + use <literal>FORCE NOT NULL</> to prevent <literal>NULL</> input |
| 496 | + comparisons for specific columns. |
496 | 497 | </para>
|
497 | 498 |
|
498 | 499 | <note>
|
499 | 500 | <para>
|
500 | 501 | CSV mode will both recognize and produce CSV files with quoted
|
501 | 502 | values containing embedded carriage returns and line feeds. Thus
|
502 | 503 | the files are not strictly one line per table row like text-mode
|
503 |
| - files. |
| 504 | + files. However, <productname>PostgreSQL</productname> will reject |
| 505 | + <command>COPY</command> input if any fields contain embedded line |
| 506 | + end character sequences that do not match the line ending |
| 507 | + convention used in the CSV file itself. It is generally safer to |
| 508 | + import data containing embedded line end characters using the |
| 509 | + text or binary formats rather than CSV. |
504 | 510 | </para>
|
505 | 511 | </note>
|
506 | 512 |
|
|
0 commit comments