Re: proposal: table functions and plpgsql

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Hannu Krosing" <hannu(at)krosing(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: table functions and plpgsql
Date: 2008-05-21 21:01:10
Message-ID: 162867790805211401ke8d9f62u5e287670fbb7174b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/5/21 Hannu Krosing <hannu(at)krosing(dot)net>:
> 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 ?

little - it's ANSI SQL compatible and I hope, it's less cryptic for beginers.
>
> 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 | 0
> 1 | 1
> 2 | 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
>
> --------------

My proposal is less relevant to external languages - there isn't
problem with name collisions

Pavel
> Hannu
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2008-05-21 21:03:53 Re: proposal: table functions and plpgsql
Previous Message Hannu Krosing 2008-05-21 18:14:47 Re: proposal: table functions and plpgsql