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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Values list-of-targetlists patch for comments (was Re: [HACKERS] 8.2 features?)
Дата
Msg-id 28402.1154486324@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Values list-of-targetlists patch for comments (was Re:  (Gavin Sherry <swm@linuxworld.com.au>)
Список pgsql-patches
Gavin Sherry <swm@linuxworld.com.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

В списке pgsql-patches по дате отправления:

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: Replication Documentation
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Replication Documentation