pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Markus Bertheau ??? <twanger@bluetwanger.de>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: Impossible with pl/pgsql?
Date: Mon, 30 May 2005 10:13:33 -0600
Message-ID: <20050530161332.GA78929@winnie.fuhr.org> (raw)
In-Reply-To: <1117466155.20420.7.camel@dicaprio.akademie1.de>
References: <1117466155.20420.7.camel@dicaprio.akademie1.de>

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/



view thread (4+ messages)  latest in thread

Message-ID: <20050530161332.GA78929@winnie.fuhr.org>
Permalink:  ../20050530161332.GA78929@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050530161332.GA78929@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, twanger@bluetwanger.de
  Subject: Re: Impossible with pl/pgsql?
  In-Reply-To: <20050530161332.GA78929@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox