diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-07-18 04:43:51 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-07-18 04:43:51 +0000 |
commit | a90db34b542d9f31582627a0bfa43901811b84b2 (patch) | |
tree | e0ac399fd5a3caddd24ac8c82d24a37deee4305a /doc/src | |
parent | fc5372e09930766f3559555e19262b4b861f3646 (diff) | |
download | postgresql-a90db34b542d9f31582627a0bfa43901811b84b2.tar.gz postgresql-a90db34b542d9f31582627a0bfa43901811b84b2.zip |
The attached patch (against HEAD) implements
COPY x (a,d,c,b) from stdin;
COPY x (a,c) to stdout;
as well as the corresponding changes to pg_dump to use the new
functionality. This functionality is not available when using
the BINARY option. If a column is not specified in the COPY FROM
statement, its default values will be used.
In addition to this functionality, I tweaked a couple of the
error messages emitted by the new COPY <options> checks.
Brent Verner
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/copy.sgml | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 28ca264c65c..a1a5e9baa76 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.32 2002/06/20 16:00:43 momjian Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.33 2002/07/18 04:43:50 momjian Exp $ PostgreSQL documentation --> @@ -21,7 +21,8 @@ PostgreSQL documentation <date>1999-12-11</date> </refsynopsisdivinfo> <synopsis> -COPY <replaceable class="parameter">table</replaceable> +COPY <replaceable class="parameter">table</replaceable> + [ ( <replaceable class="parameter">column</replaceable> [, ...] ) ] FROM { '<replaceable class="parameter">filename</replaceable>' | <filename>stdin</filename> } [ [ WITH ] [ BINARY ] @@ -29,6 +30,7 @@ COPY <replaceable class="parameter">table</replaceable> [ DELIMITER [ AS ] '<replaceable class="parameter">delimiter</replaceable>' ] [ NULL [ AS ] '<replaceable class="parameter">null string</replaceable>' ] ] COPY <replaceable class="parameter">table</replaceable> + [ ( <replaceable class="parameter">column</replaceable> [, ...] ) ] TO { '<replaceable class="parameter">filename</replaceable>' | <filename>stdout</filename> } [ [ WITH ] [ BINARY ] @@ -55,6 +57,16 @@ COPY <replaceable class="parameter">table</replaceable> </para> </listitem> </varlistentry> + + <varlistentry> + <term><replaceable class="parameter">column list</replaceable></term> + <listitem> + <para> + An optional list of columns to be copied. If no column list is + specified, all columns will be used. + </para> + </listitem> + </varlistentry> <varlistentry> <term><replaceable class="parameter">filename</replaceable></term> @@ -187,6 +199,14 @@ 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> + <para> <command>COPY</command> with a file name instructs the <productname>PostgreSQL</productname> backend to directly read from |