mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user