Thread: docs: WITH queries and VALUES

docs: WITH queries and VALUES

From
Magnus Hagander
Date:
The SELECT manpage has:

and with_query is:
   with_query_name [ ( column_name [, ...] ) ] AS ( select | insert |
update | delete )


Should that list that you can use values as well? Or is it something
we generally consider "wherever select works you can use values"?

(I ran into it because it's what comes up when you do \h WITH, so I
got the question of "why is values not supported for with". but it
is..)

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: docs: WITH queries and VALUES

From
Stephen Frost
Date:
* Magnus Hagander (magnus@hagander.net) wrote:
>     with_query_name [ ( column_name [, ...] ) ] AS ( select | insert |
> update | delete )
>
>
> Should that list that you can use values as well? Or is it something
> we generally consider "wherever select works you can use values"?
>
> (I ran into it because it's what comes up when you do \h WITH, so I
> got the question of "why is values not supported for with". but it
> is..)

TABLE also works there, and here:
[ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ]

and here:
( select ) [ AS ] alias [ ( column_alias [, ...] ) ]

Not sure if it's worth fixing, just something I noticed.
Thanks,
    Stephen

Re: docs: WITH queries and VALUES

From
Tom Lane
Date:
Stephen Frost <sfrost@snowman.net> writes:
> * Magnus Hagander (magnus@hagander.net) wrote:
>> with_query_name [ ( column_name [, ...] ) ] AS ( select | insert |
>> update | delete )
>> Should that list that you can use values as well? Or is it something
>> we generally consider "wherever select works you can use values"?

> TABLE also works there, and here:

Well, "TABLE foo" is defined as a shorthand for "SELECT * FROM foo",
so ISTM it's not too surprising that you can use it wherever you
can use SELECT.  I'm not sure that people have a similar view of
VALUES though.  It might be worth adding VALUES to the WITH syntax.
        regards, tom lane


Re: docs: WITH queries and VALUES

From
Peter Eisentraut
Date:
On tor, 2012-04-12 at 11:59 +0200, Magnus Hagander wrote:
> The SELECT manpage has:
> 
> and with_query is:
> 
>     with_query_name [ ( column_name [, ...] ) ] AS ( select | insert |
> update | delete )
> 
> 
> Should that list that you can use values as well? Or is it something
> we generally consider "wherever select works you can use values"?

Added.



Re: docs: WITH queries and VALUES

From
Magnus Hagander
Date:
<p><br /> On Apr 14, 2012 8:09 AM, "Peter Eisentraut" <<a href="mailto:peter_e@gmx.net">peter_e@gmx.net</a>>
wrote:<br/> ><br /> > On tor, 2012-04-12 at 11:59 +0200, Magnus Hagander wrote:<br /> > > The SELECT
manpagehas:<br /> > ><br /> > > and with_query is:<br /> > ><br /> > >     with_query_name [ (
column_name[, ...] ) ] AS ( select | insert |<br /> > > update | delete )<br /> > ><br /> > ><br />
>> Should that list that you can use values as well? Or is it something<br /> > > we generally consider
"whereverselect works you can use values"?<br /> ><br /> > Added.<br /> ><br /> Thanks! <p>/Magnus