Re: COPY manual is ambiguous about column list
Bruce Momjian <[email protected]> Fri, 20 Dec 2019 08:45:41 -0500
| Newsgroups | gmane.comp.db.postgresql.devel.documentation |
|---|---|
| Message-ID | <[email protected]> |
--7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Thu, Dec 19, 2019 at 10:33:48PM -0700, David G. Johnston wrote: > On Thursday, December 19, 2019, Tom Lane <[email protected]> wrote: > > "David G. Johnston" <[email protected]> writes: > > Seems better to simply talk about each form independently: > > > If a list of columns is specified, <command>COPY TO</command> will only > > copy the data in the specified columns to the file. <command>COPY > > FROM</command> will, by position (i.e., the number of columns listed must > > match the number of columns in the file), match each file column to the > > named column in the table. Any additional columns present in the table > > will receive their default value. > > +1 for separating it like that, but your middle sentence reads awkwardly > to me. How about something like > > <command>COPY FROM</command> will match each listed column in the table > to a file column by position (so the number of columns listed must match > the number of columns in the file). > > > > > +1 OK, how is this? -- 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 + --7JfCtLOvnd9MIVvH Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="copy.diff" diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml new file mode 100644 index d9b7c4d..cf19706 *** 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,72 ---- </para> <para> ! If a column list is specified, <command>COPY TO</command> copies only ! the data in the specified columns to the file. If a column list is ! specified in <command>COPY FROM</command>, the number and position of ! the columns must match those fields in the file. Table columns not ! specified in the <command>COPY FROM</command> column list will insert ! their default values. </para> <para> --7JfCtLOvnd9MIVvH--