Re: Declaring arrays in plpgsql functions - Mailing list pgsql-sql

From Tom Lane
Subject Re: Declaring arrays in plpgsql functions
Date
Msg-id 24133.1017085022@sss.pgh.pa.us
Whole thread Raw
In response to Declaring arrays in plpgsql functions  (Daniel Lundin <daniel@helena-daniel.se>)
Responses Re: Declaring arrays in plpgsql functions
List pgsql-sql
Daniel Lundin <daniel@helena-daniel.se> writes:
> I'm trying to convert rows from a table into a two dimensional array, and
> thought I could do so in a plpgsql function, but I can't declare the return
> variable as an array:

The declaration is fine (at least it works for me, in 7.2).  The trouble
is with:

>         text[array_dim(text) + 1][0] := rs.src;
>         text[array_dim(text) + 1][1] := rs.id;

plpgsql doesn't support assigning to array elements :-(.  (Even if it
did, you couldn't use array_dims() like that --- array_dims() returns
a string.)
        regards, tom lane


pgsql-sql by date:

Previous
From: "Marin Dimitrov"
Date:
Subject: Re: 16 parameter
Next
From: Tom Lane
Date:
Subject: Re: Declaring arrays in plpgsql functions