Re: COPY manual is ambiguous about column list
"David G. Johnston" <[email protected]> Thu, 19 Dec 2019 22:33:48 -0700
| Newsgroups | gmane.comp.db.postgresql.devel.documentation |
|---|---|
| Message-ID | <CAKFQuwYHOpSfBcyX33Avt3ncrDsu6pxb-LXTm0SA+-nGWVSbhQ@mail.gmail.com> |
--000000000000b2b0c7059a1c05d3 Content-Type: text/plain; charset="UTF-8" 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 David J. --000000000000b2b0c7059a1c05d3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thursday, December 19, 2019, Tom Lane <<a href=3D"mailto:[email protected].= pa.us">[email protected]</a>> wrote:<br><blockquote class=3D"gmail_quote= " style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&= quot;David G. Johnston" <<a href=3D"mailto:[email protected]= om">[email protected]</a>> writes:<br> > Seems better to simply talk about each form independently:<br> <br> > If a list of columns is specified, <command>COPY TO</command&= gt; will only<br> > copy the data in the specified columns to the file.=C2=A0 <command&= gt;COPY<br> > FROM</command> will, by position (i.e., the number of columns li= sted must<br> > match the number of columns in the file), match each file column to th= e<br> > named column in the table.=C2=A0 Any additional columns present in the= table<br> > will receive their default value.<br> <br> +1 for separating it like that, but your middle sentence reads awkwardly<br= > to me.=C2=A0 How about something like<br> <br> =C2=A0 <command>COPY FROM</command> will match each listed colu= mn in the table<br> =C2=A0 to a file column by position (so the number of columns listed must m= atch<br> =C2=A0 the number of columns in the file).<br> <br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0<br= > </blockquote><div><br></div><div>+1</div><div><br></div><div>David J.</div>= <div>=C2=A0</div> --000000000000b2b0c7059a1c05d3--