X-Original-To: pgsql-docs-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 8FAC99FB252; Wed, 9 Aug 2006 14:10:19 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 37549-01; Wed, 9 Aug 2006 17:10:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 947F99FB21B; Wed, 9 Aug 2006 14:10:15 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k79H7U6q027401; Wed, 9 Aug 2006 13:07:30 -0400 (EDT) To: David Fetter cc: Peter Eisentraut , pgsql-hackers@postgresql.org, Gavin Sherry , Michael Glaesemann , Joe Conway , pgsql-patches@postgresql.org, pgsql-docs@postgresql.org Subject: Re: [HACKERS] [PATCHES] Values list-of-targetlists patch for comments (was Re: In-reply-to: <20060809162242.GA19092@fetter.org> References: <44B69778.5050104@dunslane.net> <969.1154659817@sss.pgh.pa.us> <200608091505.04383.peter_e@gmx.net> <20060809162242.GA19092@fetter.org> Comments: In-reply-to David Fetter message dated "Wed, 09 Aug 2006 09:22:42 -0700" Date: Wed, 09 Aug 2006 13:07:30 -0400 Message-ID: <27400.1155143250@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200608/18 X-Sequence-Number: 3636 David Fetter writes: > However, there are some oddities: > postgres=# SELECT * FROM (VALUES (1,2)) AS foo(bar,baz); > [ works ] > postgres=# (VALUES (1,2)) AS foo(bar,baz); > ERROR: syntax error at or near "AS" This is per spec. Effectively, AS is part of the FROM-clause syntax not part of a standalone command. You can't write this either: regression=# (select 1,2) as foo(bar,baz); ERROR: syntax error at or near "as" LINE 1: (select 1,2) as foo(bar,baz); ^ regards, tom lane