Re: Values list-of-targetlists patch for comments (was Re: [HACKERS] 8.2 features?)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Joe Conway <mail(at)joeconway(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Values list-of-targetlists patch for comments (was Re: [HACKERS] 8.2 features?)
Date: 2006-08-02 02:38:44
Message-ID: 28402.1154486324@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers pgsql-patches

Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> Is this intentional:

> template1=# values(1), (2);
> column1
> ---------
> 1
> 2
> (2 rows)

You bet. VALUES is parallel to SELECT in the SQL grammar, so AFAICS
it should be legal anywhere you can write SELECT.

The basic productions in the spec's grammar are respectively

<query specification> ::=
SELECT [ <set quantifier> ] <select list>
<table expression>

and

<table value constructor> ::=
VALUES <row value expression list>

and both of them link into the rest of the grammar here:

<simple table> ::=
<query specification>
| <table value constructor>
| <explicit table>

There is no construct I can find in the spec grammar that allows
<query specification> but not <table value constructor>. QED.

Try some stuff like
DECLARE c CURSOR FOR VALUES ...
WHERE foo IN (VALUES ...

regards, tom lane

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2006-08-02 02:52:00 Re: Values list-of-targetlists patch for comments (was Re: [PATCHES] 8.2 features?)
Previous Message Joe Conway 2006-08-02 02:10:50 Re: Values list-of-targetlists patch for comments (was Re:

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-02 02:52:00 Re: Values list-of-targetlists patch for comments (was Re: [PATCHES] 8.2 features?)
Previous Message Christopher Browne 2006-08-02 02:27:33 Re: Replication Documentation

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-08-02 02:52:00 Re: Values list-of-targetlists patch for comments (was Re: [PATCHES] 8.2 features?)
Previous Message Christopher Browne 2006-08-02 02:27:33 Re: Replication Documentation