Re: Declaring arrays in plpgsql functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Lundin <daniel(at)helena-daniel(dot)se>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Declaring arrays in plpgsql functions
Date: 2002-03-25 19:37:02
Message-ID: 24133.1017085022@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Daniel Lundin <daniel(at)helena-daniel(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-03-25 19:41:49 Re: Declaring arrays in plpgsql functions
Previous Message Marin Dimitrov 2002-03-25 18:08:24 Re: 16 parameter