1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

IMPROVED VERSION APPLIED:

The attached patch completes the following TODO item:

    * Generate failure on short COPY lines rather than pad NULLs

I also restructed a lot of the existing COPY code, did some code
review on the column list patch sent in by Brent Verner a little
while ago, and added some regression tests. I also added an
explicit check (and resultant error) for extra data before
the end-of-line.

Neil Conway
This commit is contained in:
Bruce Momjian
2002-07-30 16:55:06 +00:00
parent 1dedbf2da5
commit 874148fe34
4 changed files with 318 additions and 209 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.33 2002/07/18 04:43:50 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.34 2002/07/30 16:55:05 momjian Exp $
PostgreSQL documentation
-->
@ -199,12 +199,12 @@ ERROR: <replaceable>reason</replaceable>
whatever is in the table already).
</para>
<para>
When using the optional column list syntax, <command>COPY TO</command>
and <command>COPY FROM</command> will only copy the specified
columns' values to/from the table. If a column in the table
is not in the column list, <command>COPY FROM</command> will insert
default values for that column if a default value is defined.
<para>
If a list of columns is specified, <command>COPY</command> will
only copy the data in the specified columns to or from the table.
If there are any columns in the table that are not in the table,
<command>COPY FROM</command> will insert the default value for
that column.
</para>
<para>
@ -266,8 +266,8 @@ ERROR: <replaceable>reason</replaceable>
</para>
<para>
<command>COPY FROM</command> neither invokes rules nor acts on column
defaults. It does invoke triggers and check constraints.
<command>COPY FROM</command> will invoke any triggers or check
constraints. However, it will not invoke rules.
</para>
<para>
@ -330,7 +330,12 @@ ERROR: <replaceable>reason</replaceable>
The attribute values themselves are strings generated by the
output function, or acceptable to the input function, of each
attribute's data type. The specified null-value string is used in
place of attributes that are NULL.
place of attributes that are NULL. When using <command>COPY
FROM</command> without a column list, each row of the input file
must contain data for each attribute in the table: no missing data
is allowed. Similarly, <command>COPY FROM</command> will raise
an error if it encounters any data in the input file that would
not be inserted into the table: extra data is not allowed.
</para>
<para>
If OIDS is specified, the OID is read or written as the first column,