Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id CE5559F9EDF for ; Tue, 21 Aug 2007 22:55:57 -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 27510-05 for ; Tue, 21 Aug 2007 22:55:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id E799F9F9ED4 for ; Tue, 21 Aug 2007 22:55:54 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-221-172.bk12-dsl.surnet.cl [201.221.221.172]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l7M1tvYe021295; Tue, 21 Aug 2007 18:55:57 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id CA53B47C5B; Tue, 21 Aug 2007 21:55:44 -0400 (CLT) Date: Tue, 21 Aug 2007 21:55:44 -0400 From: Alvaro Herrera To: Gregory Stark Cc: Michael Glaesemann , Richard Broersma Jr , SQL Postgresql List Subject: Re: SELECT syntax synopsis: column_definition? Message-ID: <20070822015544.GB12717@alvh.no-ip.org> References: <830878.14424.qm@web31803.mail.mud.yahoo.com> <50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net> <87zm0kigwe.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87zm0kigwe.fsf@oxford.xeocode.com> User-Agent: Mutt/1.5.16 (2007-06-11) X-Virus-Scanned: ClamAV 0.91.1/4018/Tue Aug 21 03:42:09 2007 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Tue, 21 Aug 2007 18:55:59 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/185 X-Sequence-Number: 29123 Gregory Stark wrote: > "Michael Glaesemann" writes: > > > ERROR: a column definition list is only allowed for functions returning > > "record" > > > > So the *form* is right, but I don't know of an example that works. > > postgres=# create function testf() returns record as 'select 1' language sql; > CREATE FUNCTION > postgres=# select * from testf() as (i integer); > i > --- > 1 > (1 row) > > > 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. Any function declared as returning SETOF RECORD needs it, when you don't use OUT params. Before OUT params existed, it was the only way to use those functions. -- Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4" "The eagle never lost so much time, as when he submitted to learn of the crow." (William Blake)