X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 75DD452809 for ; Mon, 30 May 2005 13:13:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52260-03 for ; Mon, 30 May 2005 16:13:43 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 331E052800 for ; Mon, 30 May 2005 13:13:41 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j4UGDXr4045162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 30 May 2005 10:13:35 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j4UGDXk5078988; Mon, 30 May 2005 10:13:33 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j4UGDXQe078987; Mon, 30 May 2005 10:13:33 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 30 May 2005 10:13:33 -0600 From: Michael Fuhr To: Markus Bertheau ??? Cc: "'pgsql-sql@postgresql.org'" Subject: Re: Impossible with pl/pgsql? Message-ID: <20050530161332.GA78929@winnie.fuhr.org> References: <1117466155.20420.7.camel@dicaprio.akademie1.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1117466155.20420.7.camel@dicaprio.akademie1.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/237 X-Sequence-Number: 21550 On Mon, May 30, 2005 at 05:15:55PM +0200, Markus Bertheau ??? wrote: > > Now how would a query look like that involves find() and decorate() and > returns > > id | name | author | last_change > -------------------------------- > 4 | egg | john | 2003-05-05 > 5 | ham | dave | 2004-03-01 Either of the following should work in PostgreSQL 8.0 and later: SELECT (decorate(x)).* FROM find() AS f(x); SELECT (decorate(find)).* FROM find(); A downside is that decorate() will be called once for each output column in each row, as can be seen by adding debugging RAISE statements. So in your example it would be called eight times (2 rows * 4 columns) instead of twice (once for each of 2 rows). -- Michael Fuhr http://www.fuhr.org/~mfuhr/