Thread: COPY with column list

COPY with column list

From
Brent Verner
Date:
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 new
functionality.  This functionality is not available when using
the BINARY option.  If a column is not specified in the COPY FROM
statement, its default values will be used.

In addition to this functionality, I tweaked a couple of the
error messages emitted by the new COPY <options> checks.

cheers.
  brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

Attachment

Re: COPY with column list

From
nconway@klamath.dyndns.org (Neil Conway)
Date:
On Wed, Jul 10, 2002 at 02:12:14AM -0400, Brent Verner wrote:
> The attached patch (against HEAD) implements
>
>   COPY x (a,d,c,b) from stdin;
>   COPY x (a,c) to stdout;

We usually don't allow C++ style comments, such as

> +     // fmtQualifiedId(tbinfo->relnamespace->nspname,classname),

Other than that, looks OK to me.

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

Re: COPY with column list

From
Brent Verner
Date:
[2002-07-10 15:55] Neil Conway said:
| On Wed, Jul 10, 2002 at 02:12:14AM -0400, Brent Verner wrote:
| > The attached patch (against HEAD) implements
| >
| >   COPY x (a,d,c,b) from stdin;
| >   COPY x (a,c) to stdout;
|
| We usually don't allow C++ style comments, such as
|
| > +     // fmtQualifiedId(tbinfo->relnamespace->nspname,classname),

yeah, yeah, yeah, I know :-)  That line should have been removed,
not just commented out...

I'll resubmit a patch that updates the COPY comment in gram.y
in addition to removing the offending cruft mentioned above.

cheers.
  b

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

Re: COPY with column list

From
Brent Verner
Date:
[2002-07-10 17:01] Brent Verner said:
| I'll resubmit a patch that updates the COPY comment in gram.y
| in addition to removing the offending cruft mentioned above.

patch attached.  Also adds a check to enable the COPY column list
only when the remote server version is >=7.3.

  b

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

Attachment

Re: COPY with column list

From
Brent Verner
Date:
[2002-07-10 17:52] Brent Verner said:
| [2002-07-10 17:01] Brent Verner said:
| | I'll resubmit a patch that updates the COPY comment in gram.y
| | in addition to removing the offending cruft mentioned above.
|
| patch attached.  Also adds a check to enable the COPY column list
| only when the remote server version is >=7.3.

<hiding...>

  Attached is a _working_ patch.  Also I've added a copy2.sql regression
test which exercises this functionality; default values in addition to
before/after triggers.  I've added a small note to the ref/copy.sgml
mentioning the new functionality.

cheers.
  b


Re: COPY with column list

From
Brent Verner
Date:
[2002-07-13 21:48] Brent Verner said:
| [2002-07-10 17:52] Brent Verner said:
| | [2002-07-10 17:01] Brent Verner said:
| | | I'll resubmit a patch that updates the COPY comment in gram.y
| | | in addition to removing the offending cruft mentioned above.
| |
| | patch attached.  Also adds a check to enable the COPY column list
| | only when the remote server version is >=7.3.
|
| <hiding...>

  just shoot me, now.  patch attached.

argh!
  b

Attachment

Re: COPY with column list

From
Bruce Momjian
Date:
The most reccent version of this patch has been added to the PostgreSQL
unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Brent Verner wrote:
> 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 new
> functionality.  This functionality is not available when using
> the BINARY option.  If a column is not specified in the COPY FROM
> statement, its default values will be used.
>
> In addition to this functionality, I tweaked a couple of the
> error messages emitted by the new COPY <options> checks.
>
> cheers.
>   brent
>
> --
> "Develop your talent, man, and leave the world something. Records are
> really gifts from people. To think that an artist would love you enough
> to share his music with anyone is a beautiful thing."  -- Duane Allman

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: COPY with column list

From
Bruce Momjian
Date:
Patch applied.  Thanks.

---------------------------------------------------------------------------



Brent Verner wrote:
> 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 new
> functionality.  This functionality is not available when using
> the BINARY option.  If a column is not specified in the COPY FROM
> statement, its default values will be used.
>
> In addition to this functionality, I tweaked a couple of the
> error messages emitted by the new COPY <options> checks.
>
> cheers.
>   brent
>
> --
> "Develop your talent, man, and leave the world something. Records are
> really gifts from people. To think that an artist would love you enough
> to share his music with anyone is a beautiful thing."  -- Duane Allman

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026