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

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

From
Zoltan Boszormenyi
Date:
Bruce Momjian írta:
> 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.

Best regards,
Zoltán Böszörményi


Attachment

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

From
Alvaro Herrera
Date:
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
quoteas '"'; 
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

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

From
Tom Lane
Date:
Alvaro Herrera <alvherre@commandprompt.com> writes:
> ... I'd do it myself but I'm heading to bed right now.
> ...
> I'll repost a reworked version at some point, if no one beats me to it.

I was planning to start looking at this patch tomorrow (unless Gavin
produces a new bitmap-index patch by then).  I'll work from this one
unless somebody produces a better version meanwhile.

            regards, tom lane