COPY with column list

Started by Brent Vernerabout 24 years ago8 messagespatches
Jump to latest
#1Brent Verner
brent@rcfile.org

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

Attachments:

copy-colspec.2002071001.difftext/plain; charset=us-asciiDownload+281-115
#2Neil Conway
neilc@samurai.com
In reply to: Brent Verner (#1)
Re: COPY with column list

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

#3Brent Verner
brent@rcfile.org
In reply to: Neil Conway (#2)
Re: COPY with column list

[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

#4Brent Verner
brent@rcfile.org
In reply to: Brent Verner (#3)
Re: COPY with column list

[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

Attachments:

copy-colspec.2002071003.difftext/plain; charset=us-asciiDownload+287-117
#5Brent Verner
brent@rcfile.org
In reply to: Brent Verner (#4)
Re: COPY with column list

[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

#6Brent Verner
brent@rcfile.org
In reply to: Brent Verner (#5)
Re: COPY with column list

[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

Attachments:

copy-colspec.20020713.004.difftext/plain; charset=us-asciiDownload+314-128
#7Bruce Momjian
bruce@momjian.us
In reply to: Brent Verner (#1)
Re: COPY with column list

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
#8Bruce Momjian
bruce@momjian.us
In reply to: Brent Verner (#1)
Re: COPY with column list

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