Skip to content

Commit 874148f

Browse files
committed
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
1 parent 1dedbf2 commit 874148f

File tree

4 files changed

+319
-210
lines changed

4 files changed

+319
-210
lines changed

doc/src/sgml/ref/copy.sgml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.33 2002/07/18 04:43:50 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.34 2002/07/30 16:55:05 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -199,12 +199,12 @@ ERROR: <replaceable>reason</replaceable>
199199
whatever is in the table already).
200200
</para>
201201

202-
<para>
203-
When using the optional column list syntax, <command>COPY TO</command>
204-
and <command>COPY FROM</command> will only copy the specified
205-
columns' values to/from the table. If a column in the table
206-
is not in the column list, <command>COPY FROM</command> will insert
207-
default values for that column if a default value is defined.
202+
<para>
203+
If a list of columns is specified, <command>COPY</command> will
204+
only copy the data in the specified columns to or from the table.
205+
If there are any columns in the table that are not in the table,
206+
<command>COPY FROM</command> will insert the default value for
207+
that column.
208208
</para>
209209

210210
<para>
@@ -266,8 +266,8 @@ ERROR: <replaceable>reason</replaceable>
266266
</para>
267267

268268
<para>
269-
<command>COPY FROM</command> neither invokes rules nor acts on column
270-
defaults. It does invoke triggers and check constraints.
269+
<command>COPY FROM</command> will invoke any triggers or check
270+
constraints. However, it will not invoke rules.
271271
</para>
272272

273273
<para>
@@ -330,7 +330,12 @@ ERROR: <replaceable>reason</replaceable>
330330
The attribute values themselves are strings generated by the
331331
output function, or acceptable to the input function, of each
332332
attribute's data type. The specified null-value string is used in
333-
place of attributes that are NULL.
333+
place of attributes that are NULL. When using <command>COPY
334+
FROM</command> without a column list, each row of the input file
335+
must contain data for each attribute in the table: no missing data
336+
is allowed. Similarly, <command>COPY FROM</command> will raise
337+
an error if it encounters any data in the input file that would
338+
not be inserted into the table: extra data is not allowed.
334339
</para>
335340
<para>
336341
If OIDS is specified, the OID is read or written as the first column,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy