pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gavin Sherry <swm@linuxworld.com.au>
Cc: Joe Conway <mail@joeconway.com>
Cc: pgsql-patches@postgresql.org
Subject: Re: Values list-of-targetlists patch for comments (was Re: [HACKERS] 8.2 features?)
Date: Tue, 01 Aug 2006 22:38:44 -0400
Message-ID: <28402.1154486324@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.58.0608021005220.14057@linuxworld.com.au>
References: <44B69778.5050104@dunslane.net>
	<ECCAAC0A3182895D3D12B0E8@[172.26.14.247]>
	<44B7ADFC.90205@dunslane.net>
	<44BC0432.3040509@joeconway.com>
	<44BC661F.80609@joeconway.com>
	<44BCD06C.3060409@calorieking.com>
	<44BCF1D4.3010807@dunslane.net>
	<5842.1153246741@sss.pgh.pa.us>
	<44BD8854.9060506@calorieking.com>
	<15212.1153279954@sss.pgh.pa.us>
	<44BDB2F5.7080003@joeconway.com>
	<44BEA710.6060700@joeconway.com>
	<23198.1153367887@sss.pgh.pa.us>
	<44BF0382.2010501@joeconway.com>
	<23454.1153370214@sss.pgh.pa.us>
	<44BF122F.1080200@joeconway.com>
	<23927.1153373971@sss.pgh.pa.us>
	<44C00E1E.1000405@joeconway.com>
	<14047.1153442773@sss.pgh.pa.us>
	<44C4451A.4010906@joeconway.com>
	<11495.1153757531@sss.pgh.pa.us>
	<44C4F625.2050304@joeconway.com>
	<12029.1153760969@sss.pgh.pa.us>
	<44CC0A66.6070903@joeconway.com>
	<16429.1154463351@sss.pgh.pa.us>
	<44CFBC78.2020508@joeconway.com>
	<27359.1154474195@sss.pgh.pa.us>
	<Pine.LNX.4.58.0608021005220.14057@linuxworld.com.au>

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



view thread (61+ messages)  latest in thread

Message-ID: <28402.1154486324@sss.pgh.pa.us>
Permalink:  ../28402.1154486324@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28402.1154486324@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, swm@linuxworld.com.au, mail@joeconway.com, pgsql-patches@postgresql.org
  Subject: Re: Values list-of-targetlists patch for comments (was Re: [HACKERS] 8.2 features?)
  In-Reply-To: <28402.1154486324@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox