Re: proposal: table functions and plpgsql - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: proposal: table functions and plpgsql
Date
Msg-id 1211390892.7045.10.camel@huvostro
Whole thread Raw
In response to proposal: table functions and plpgsql  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Responses Re: proposal: table functions and plpgsql  ("Merlin Moncure" <mmoncure@gmail.com>)
Re: proposal: table functions and plpgsql  ("Pavel Stehule" <pavel.stehule@gmail.com>)
List pgsql-hackers
On Wed, 2008-05-21 at 18:12 +0200, Pavel Stehule wrote:
> Hello

...

> In my proposal I don't create any default variables. Result type is
> only virtual - I don't need write it to system directory. I thing it's
> better than using some specific predeclared type as RESULTTYPE OR
> RESULTSET.

How is this different from using OUT params and RETURNS SETOF RECORD ?

hannu=# CREATE FUNCTION outsetof2py(n integer, OUT i integer, OUT j
integer) RETURNS SETOF record   AS $$
for i in xrange(n):   yield {'i':i,'j':i*i}
$$   LANGUAGE plpythonu;
CREATE FUNCTION
hannu=# select * from outsetof2py(3);i | j 
---+---0 | 01 | 12 | 4
(3 rows)

btw, this currently works for pl/python only in my local copy (still
testing for bugs), but similar declaration works fine for pl/pgsql

--------------
Hannu




pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: [PATCHES] WITH RECURSIVE patch V0.1
Next
From: "Merlin Moncure"
Date:
Subject: Re: proposal: table functions and plpgsql