public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: David G. Johnston <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Pavlo Golub <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: COPY manual is ambiguous about column list
Date: Fri, 20 Dec 2019 10:01:28 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKFQuwa5RToC3+mbVGydTJZsqZhACK+F_CDtpcrCzxqwGXk6Cg@mail.gmail.com>
References: <[email protected]>
	<CAMtUEpBmq3Mefkyh=RmkC4Fuqq+YtbUrr_nHnzxUwEbwm+CPfg@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAKFQuwaxE-m5VKQkOapv+3kMnP2Q9hEb0NbGeBfqkQuX3UmVgQ@mail.gmail.com>
	<[email protected]>
	<CAKFQuwYHOpSfBcyX33Avt3ncrDsu6pxb-LXTm0SA+-nGWVSbhQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAKFQuwa5RToC3+mbVGydTJZsqZhACK+F_CDtpcrCzxqwGXk6Cg@mail.gmail.com>

On Fri, Dec 20, 2019 at 07:29:33AM -0700, David G. Johnston wrote:
> This has the same "match by name" possibility when I read it...
> 
> I don't see the benefit of repeating "If a column list is specified" a second
> time in the three sentence paragraph.  To a lesser extent the same goes for the
> second repetition of COPY FROM.
> 
> I agree with the general goal of trying to get rid of the parenthetical; to
> that end:
> <command>COPY FROM</command> will match all listed columns in the table to
> *all* file columns by position.
> 
> That sufficiently implies the "must have equal numbers" and, frankly, if
> someone gets that part wrong the immediate failure combined with re-reading the
> word "all" should provide sufficient clarity.
> 
> So I'm still for Tom and mine combined proposal with cleaning up the middle
> sentence even more.
> 
> The other point of note is the difference between:
> 
> will receive their default value
> and
> will insert the default values
> 
> The system is inserting default values but the columns are receiving them.  The
> sentence is relative to the table columns though so "receive" seems like the
> better fit.  Minor point overall though.

OK, this wording is obviously harder than I thought.  Updated patch
attached.

-- 
  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..a99f815
*** a/doc/src/sgml/ref/copy.sgml
--- b/doc/src/sgml/ref/copy.sgml
*************** COPY { <replaceable class="parameter">ta
*** 61,71 ****
    </para>
  
    <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>
--- 61,71 ----
    </para>
  
    <para>
!    If a column list is specified, <command>COPY TO</command> copies only
!    the data in the specified columns to the file.  For <command>COPY
!    FROM</command>, each field in the file is inserted, in order, into the
!    specified column.  Table columns not specified in the <command>COPY
!    FROM</command> column list will receive 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], [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