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

Re: accumulate setof ?

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" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: accumulate setof ?
Date: 2001-09-12 06:51:49
Message-ID: Pine.LNX.3.95.1010912161847.27217Y-100000@rebel.rebel.net.au (view raw or flat)
Thread:
Lists: pgsql-novice

I ahvd a play with this a bit last night.

I cant even work out how to declare an array in plpgsql.

I did a search of the docs on teh psogtres site for the word "setof" and
the hits I got back indicated that it si intended to be used when a
_query_ executed in a plpgsql fucntion returns result.

And that was the only example I could find.

I couldnt find any examples of arrays beign sued in pgsql either.

Not helpful,but maye setof isnt designed to be used how you are trying to
use it.(ie maybe there si no operator for concatenationg  data to a
setof).

I am goignto play with this a ibit more when I get time, because pl/pgsql
interests me, but it probalby wont be for a while.

Jason

On Tue, 11 Sep
2001, Bo Lorentsen wrote:

> Hi ...
> 
> I have tried to make a plgpsql function that accumulate a set of
> integers, but I find no way of doing this in the PostgreSQL
> documentation. I have made a very simple example to demonstrate my
> problem :
> 
> CREATE FUNCTION fn_integer_list( INTEGER )
> RETURNS SETOF INTEGER AS '
> DECLARE
>   SETOF INTEGER res;
> BEGIN
>   res := 1;
>   res := res + $1;
>   RETURN res;
> END'
> LANGUAGE 'plpgsql';
> 
> There is really two problems here. How does one initialize a set of
> integers, and how does one append a new value to the setof integers ?
> This example does, of course, not work :-)
> 
> If there is a reference to some documentation I should read, I will be
> happy for any hint in its direction.
> 
> /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

Responses

pgsql-novice by date

Next:From: victorDate: 2001-09-12 14:22:06
Subject: cache lookup failed
Previous:From: Bo LorentsenDate: 2001-09-11 07:43:49
Subject: accumulate setof ?

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