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