Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita90db34

Browse files
committed
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 newfunctionality. This functionality is not available when usingthe BINARY option. If a column is not specified in the COPY FROMstatement, its default values will be used.In addition to this functionality, I tweaked a couple of theerror messages emitted by the new COPY <options> checks.Brent Verner
1 parentfc5372e commita90db34

File tree

9 files changed

+267
-71
lines changed

9 files changed

+267
-71
lines changed

‎doc/src/sgml/ref/copy.sgml

Lines changed: 22 additions & 2 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.32 2002/06/20 16:00:43 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.33 2002/07/18 04:43:50 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,14 +21,16 @@ PostgreSQL documentation
2121
<date>1999-12-11</date>
2222
</refsynopsisdivinfo>
2323
<synopsis>
24-
COPY <replaceable class="parameter">table</replaceable>
24+
COPY <replaceable class="parameter">table</replaceable>
25+
[ ( <replaceable class="parameter">column</replaceable> [, ...] ) ]
2526
FROM { '<replaceable class="parameter">filename</replaceable>' | <filename>stdin</filename> }
2627
[ [ WITH ]
2728
[ BINARY ]
2829
[ OIDS ]
2930
[ DELIMITER [ AS ] '<replaceable class="parameter">delimiter</replaceable>' ]
3031
[ NULL [ AS ] '<replaceable class="parameter">null string</replaceable>' ] ]
3132
COPY <replaceable class="parameter">table</replaceable>
33+
[ ( <replaceable class="parameter">column</replaceable> [, ...] ) ]
3234
TO { '<replaceable class="parameter">filename</replaceable>' | <filename>stdout</filename> }
3335
[ [ WITH ]
3436
[ BINARY ]
@@ -55,6 +57,16 @@ COPY <replaceable class="parameter">table</replaceable>
5557
</para>
5658
</listitem>
5759
</varlistentry>
60+
61+
<varlistentry>
62+
<term><replaceable class="parameter">column list</replaceable></term>
63+
<listitem>
64+
<para>
65+
An optional list of columns to be copied. If no column list is
66+
specified, all columns will be used.
67+
</para>
68+
</listitem>
69+
</varlistentry>
5870

5971
<varlistentry>
6072
<term><replaceable class="parameter">filename</replaceable></term>
@@ -187,6 +199,14 @@ ERROR: <replaceable>reason</replaceable>
187199
whatever is in the table already).
188200
</para>
189201

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.
208+
</para>
209+
190210
<para>
191211
<command>COPY</command> with a file name instructs the
192212
<productname>PostgreSQL</productname> backend to directly read from

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp