Re: Impossible with pl/pgsql?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Markus Bertheau ??? <twanger(at)bluetwanger(dot)de>
Cc: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Impossible with pl/pgsql?
Date: 2005-05-30 16:13:33
Message-ID: 20050530161332.GA78929@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-05-30 16:21:34 Re: Impossible with pl/pgsql?
Previous Message IBM COMPUTER EMAIL LOTTERY INTERNATIONAL PROMOTIONS 2005-05-30 15:52:37 WINNING NOTIFICATION