Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 326D79F98D8 for ; Wed, 22 Aug 2007 02:33:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 77275-01 for ; Wed, 22 Aug 2007 02:33:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 150DE9F9653 for ; Wed, 22 Aug 2007 02:33:08 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l7M5X8NO002400; Wed, 22 Aug 2007 01:33:08 -0400 (EDT) To: Gregory Stark cc: "Michael Glaesemann" , "Richard Broersma Jr" , "SQL Postgresql List" Subject: Re: SELECT syntax synopsis: column_definition? In-reply-to: <87zm0kigwe.fsf@oxford.xeocode.com> References: <830878.14424.qm@web31803.mail.mud.yahoo.com> <50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net> <87zm0kigwe.fsf@oxford.xeocode.com> Comments: In-reply-to Gregory Stark message dated "Wed, 22 Aug 2007 00:53:21 +0100" Date: Wed, 22 Aug 2007 01:33:08 -0400 Message-ID: <2399.1187760788@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/188 X-Sequence-Number: 29126 Gregory Stark writes: > I haven't quite figured out how this is useful though. It probably makes more > sense if you use plpgsql but I still don't quite see what the use case is. IIRC, the case that actually convinced people to allow it was dblink. You want to be able to do something like select * from dblink('select a,b,c from remote_table') as (a int, b text, c float8); The declaration of dblink can't be any more specific than "RETURNS SETOF RECORD", so there's no help to be had there. The only way to explain to the parser what your dblink call is going to return is something like the above. And the parser does need to know it, so it knows what to expand "*" to (or more generally, to do things like joins involving the rowset result). regards, tom lane