Skip site navigation (1) Skip section navigation (2)

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

From: Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Alvaro Herrera <alvherre(at)commandprompt(dot)com>,Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Performance testing of COPY (SELECT)
Date: 2006-08-29 15:24:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Bruce Momjian írta:
> Tom Lane wrote:
>> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
>>> Zoltan Boszormenyi wrote:
>>>> My v8 had the syntax support for
>>>> 	COPY (SELECT ...) (col1, col2, ...) TO
>>>> and it was actually working. In your v9
>>>> you rewrote the syntax parsing so that
>>>> feature was lost in translation.
>>> Interesting.  I didn't realize this was possible -- obviously I didn't
>>> test it (did you have a test for it in the regression tests?  I may have
>>> missed it).  In fact, I deliberately removed the column list from the
>>> grammar, because it can certainly be controlled inside the SELECT, so I
>>> thought there was no reason the support controlling it in the COPY
>>> column list.
>> I would vote against allowing a column list here, because it's useless
>> and it strikes me as likely to result in strange syntax error messages
>> if the user makes any little mistake.  What worries me is that the
>> above looks way too nearly like a function call, which means that for
>> instance if you omit a right paren somewhere in the SELECT part, you're
>> likely to get a syntax error that points far to the right of the actual
>> mistake.  The parser could also mistake the column list for a table-alias
>> column list.
>> Specifying a column list with a view name is useful, of course, but
>> what is the point when you are writing out a SELECT anyway?
> If you don't support COPY view TO, at least return an error messsage
> that suggests using COPY (SELECT * FROM view).  And if you support COPY
> VIEW, you are going to have to support a column list for that.  Is that
> additional complexity in COPY?  If so, it might be a reason to just
> throw an error on views and do use COPY SELECT.

No, it oes not have any additional complexity,
it uses the same code COPY tablename TO uses.

> Seeing that COPY VIEW only supports TO, not FROM, and COPY SELECT
> support only TO, not FROM, it seems logical for COPY to just support
> relations, and COPY SELECT to be used for views, if we can throw an
> error on COPY VIEW to tell people to use COPY SELECT.

The additional hint would be enough if the VIEW case is
not supported.

In response to

pgsql-hackers by date

Next:From: Jim C. NasbyDate: 2006-08-29 15:26:33
Subject: Re: integration of pgcluster into postgresql
Previous:From: Michael GlaesemannDate: 2006-08-29 15:02:41
Subject: Re: [HACKERS] Interval aggregate regression failure (expected seems

pgsql-patches by date

Next:From: Bernd HelmleDate: 2006-08-29 15:53:03
Subject: Re: Updatable views
Previous:From: Michael GlaesemannDate: 2006-08-29 15:02:41
Subject: Re: [HACKERS] Interval aggregate regression failure (expected seems

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group