Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 150A09F9785 for ; Tue, 21 Aug 2007 20:05:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 36934-03 for ; Tue, 21 Aug 2007 20:04:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mtao04.charter.net (mtao04.charter.net [209.225.8.178]) by postgresql.org (Postfix) with ESMTP id 8F74A9F9775 for ; Tue, 21 Aug 2007 20:04:59 -0300 (ADT) Received: from aa02.charter.net ([10.20.200.154]) by mtao04.charter.net (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20070821230458.HQLB23660.mtao04.charter.net@aa02.charter.net>; Tue, 21 Aug 2007 19:04:58 -0400 Received: from [10.0.1.2] (really [66.188.165.91]) by aa02.charter.net with ESMTP id <20070821230458.VNOJ26124.aa02.charter.net@[10.0.1.2]>; Tue, 21 Aug 2007 19:04:58 -0400 In-Reply-To: <830878.14424.qm@web31803.mail.mud.yahoo.com> References: <830878.14424.qm@web31803.mail.mud.yahoo.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net> Cc: SQL Postgresql List Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: SELECT syntax synopsis: column_definition? Date: Tue, 21 Aug 2007 18:04:56 -0500 To: Richard Broersma Jr X-Mailer: Apple Mail (2.752.2) X-Chzlrs: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/181 X-Sequence-Number: 29119 On Aug 21, 2007, at 14:34 , Richard Broersma Jr wrote: > Can any one give an example of the difference between a > column_alias and a column_definition when > using a function in the FROM clause? > > from the manual: > http://www.postgresql.org/docs/8.2/interactive/sql-select.html > > "function_name ( [ argument [, ...] ] ) [ AS ] alias > [ ( column_alias [, ...] | column_definition > [, ...] ) ]" I believe it's similar to this # select * from generate_series(1,10) as a(s); s ---- 1 2 3 4 5 6 7 8 9 10 (10 rows) But like this: # select * from generate_series(1,10) as a(s text); But not quite, as this raises an error :) 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. You've got me curious now, too! Michael Glaesemann grzm seespotcode net