Re: [HACKERS] Performance testing of COPY (SELECT) TO

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Performance testing of COPY (SELECT) TO
Date: 2006-08-28 03:42:11
Message-ID: 20060828034211.GA24259@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Removed Cc: to pgsql-hackers.

Zoltán,

Zoltan Boszormenyi wrote:

> >Your patch has been added to the PostgreSQL unapplied patches list at:
> >
> > http://momjian.postgresql.org/cgi-bin/pgpatches
> >
> >It will be applied as soon as one of the PostgreSQL committers reviews
> >and approves it.
>
> Thanks. Would you please add this instead?
> psql built-in \copy (select ...) now also work.

Please check this one out. I took the version you posted here and
changed the stuff in the parser that I didn't like, and removed the ugly
"SELECT * FROM" stuff that was bothering me. I also removed the
transformCopyStmt stuff as it seems unnecessary to me. I did all that
stuff in a cleaner way (IMO).

I also cleaned up the grammar -- basically added a separate case from
the regular COPY. I took the opportunity to remove the
backwards-compatible options from there. I didn't check that stuff very
much but it should continue to work ...

I noticed that this works:

alvherre=# copy (values (1, 'uno'), (2, 'dos'), (3, 'tr;es'), (4, NULL)) to stdout with delimiter ';' null 'NUL' csv quote as '"';
1;uno
2;dos
3;"tr;es"
4;NUL

which is nice.

With this patch, the COPY view FROM stdout path now throws an error --
in your version it worked (because of that "COPY * FROM" stuff), and
from previous discussion it seems reasonable to behave differently for
views than for plain tables (i.e. it's reasonable that we fail for
views).

I also broke the check for a FOR UPDATE clause. Not sure where but it
must be easy to fix :-) I'd do it myself but I'm heading to bed right
now.

I also wanted to check these hunks in your patch, which I didn't like
very much:

-ERROR: column "a" of relation "test" does not exist
+ERROR: column "a" does not exist

but didn't got around to it.

I also noticed that the new copyselect regression test is not added to
the serial schedule.

I'll repost a reworked version at some point, if no one beats me to it.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Attachment Content-Type Size
copyview-9.patch text/plain 50.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2006-08-28 03:49:21 Re: jabber.postgresql.org is up
Previous Message Tom Lane 2006-08-28 03:33:52 Re: [PATCHES] Another VPATH patch for ecpg

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-08-28 03:53:20 Re: [HACKERS] Performance testing of COPY (SELECT) TO
Previous Message Tom Lane 2006-08-28 03:33:52 Re: [PATCHES] Another VPATH patch for ecpg