public inbox for [email protected]
help / color / mirror / Atom feedFrom: Bruce Momjian <[email protected]>
To: Pavlo Golub <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: [email protected]
Subject: Re: COPY manual is ambiguous about column list
Date: Thu, 19 Dec 2019 11:53:40 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAMtUEpBmq3Mefkyh=RmkC4Fuqq+YtbUrr_nHnzxUwEbwm+CPfg@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<CAMtUEpBmq3Mefkyh=RmkC4Fuqq+YtbUrr_nHnzxUwEbwm+CPfg@mail.gmail.com>
On Thu, Nov 28, 2019 at 02:53:03PM +0100, Pavlo Golub wrote:
> On Thu, 28 Nov 2019 at 10:47, Laurenz Albe <[email protected]> wrote:
> >
> > On Wed, 2019-11-27 at 17:54 +0000, PG Doc comments form wrote:
> > > "If a list of columns is specified, COPY will only copy the data in the
> > > specified columns to or from the file. If there are any columns in the table
> > > that are not in the column list, COPY FROM will insert the default values
> > > for those columns."
> > >
> > > I clearly see "to or from" file here. But if one tries to COPY FROM filename
> > > with more columns than list specified, the process fails:
> >
> > I think you misunderstood the documentation.
>
> Yeap, I did. Even two of us. Laetitia was helping me :)
>
> >
> > Nowhere in that sentence is the documentation talking about columns in
> > the file, only columns in the table.
> >
> > But if you got it wrong, maybe a clarification would be a good idea.
>
> I think it better to have more details to avoid confusion.
How is the attached patch?
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
Attachments:
[text/x-diff] copy.diff (1.0K, 2-copy.diff)
download | inline diff:
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
new file mode 100644
index d9b7c4d..475d40c
*** a/doc/src/sgml/ref/copy.sgml
--- b/doc/src/sgml/ref/copy.sgml
*************** COPY { <replaceable class="parameter">ta
*** 63,71 ****
<para>
If a list of columns is specified, <command>COPY</command> will
only copy the data in the specified columns to or from the file.
! If there are any columns in the table that are not in the column list,
! <command>COPY FROM</command> will insert the default values for
! those columns.
</para>
<para>
--- 63,72 ----
<para>
If a list of columns is specified, <command>COPY</command> will
only copy the data in the specified columns to or from the file.
! In <command>COPY FROM</command>, the number of columns specified
! must match the number of fields in the file; any table columns not
! specified in the <command>COPY FROM</command> column list will insert
! their default values.
</para>
<para>
view thread (16+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: COPY manual is ambiguous about column list
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox