Re: pl/pgsql recursion/arrays (fwd)

From: Bo Lorentsen <bl(at)netgroup(dot)dk>
To: Jason Tan <jason(at)rebel(dot)rebel(dot)net(dot)au>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: pl/pgsql recursion/arrays (fwd)
Date: 2001-09-04 08:00:43
Message-ID: 3B948A2B.A733E364@netgroup.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Jason Tan wrote:

> Is it possible to use recursion in pl/pgsql in particular with postgres
> 7.0xx?

I hope I can tell you within a few days, as I need this too :-)

> Also is it posible to declare and use array in plpgsql?

Yeps, "SETOF" is your friend.

> Is it possible to somehow return a series of values?

Yeps try "RETURNS SETOF INTEGER" to define an area of integers as a return
value from a function.

> eg to return muliple values somehow so that they can be used in somethign
> like:
> select column_name from table_name where attribute_name in (select
> my_func(column2) from table2);
>
> ie so you can effectively use a function as a filter?

Yeps, this works perfectly, like this :

SELECT a, b FROM c WHERE a.id IN (SELECT fn_return_setof());

/BL

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bo Lorentsen 2001-09-04 08:14:46 Re: Insert rule and seqences
Previous Message Jason Tan 2001-09-04 04:50:45 Re: Perl DBI Drivers