Skip site navigation (1) Skip section navigation (2)

Re: pl/pgsql recursion/arrays (fwd)

From: Jason Tan <jason(at)rebel(dot)rebel(dot)net(dot)au>
To: Bo Lorentsen <bl(at)netgroup(dot)dk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: pl/pgsql recursion/arrays (fwd)
Date: 2001-09-04 09:19:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

On Tue, 4 Sep 2001, Bo Lorentsen wrote:

> 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 :-)

I can tell you right now, it works.

I have implemented a function that recurses through records that index on
each other in tree style.

Thanks for your other info too.

I think I have read all the latest offical doco, and dont recall seeing
that (SETOF) there.


> > 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 IN (SELECT fn_return_setof());
> /BL

Jason Tan                                                jason(at)rebel(dot)net(dot)au
     "Democracy is two wolves and a lamb voting on what to have for lunch. 
                 Liberty is a well-armed lamb contesting the vote."
                               ~Benjamin Franklin, 1759

In response to


pgsql-novice by date

Next:From: Bo LorentsenDate: 2001-09-04 10:53:40
Subject: Re: pl/pgsql recursion/arrays (fwd)
Previous:From: Bo LorentsenDate: 2001-09-04 08:14:46
Subject: Re: Insert rule and seqences

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group