From 874148fe34d404d8dc77d8ed7482f16f5aaad5ba Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 30 Jul 2002 16:55:06 +0000 Subject: 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 --- doc/src/sgml/ref/copy.sgml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index a1a5e9baa76..484b0a62087 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -1,5 +1,5 @@ @@ -199,12 +199,12 @@ ERROR: reason whatever is in the table already). - - When using the optional column list syntax, COPY TO - and COPY FROM will only copy the specified - columns' values to/from the table. If a column in the table - is not in the column list, COPY FROM will insert - default values for that column if a default value is defined. + + If a list of columns is specified, COPY 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, + COPY FROM will insert the default value for + that column. @@ -266,8 +266,8 @@ ERROR: reason - COPY FROM neither invokes rules nor acts on column - defaults. It does invoke triggers and check constraints. + COPY FROM will invoke any triggers or check + constraints. However, it will not invoke rules. @@ -330,7 +330,12 @@ ERROR: reason 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 COPY + FROM 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, COPY FROM 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. If OIDS is specified, the OID is read or written as the first column, -- cgit v1.2.3