From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Lundin <daniel@helena-daniel.se>
Cc: pgsql-sql@postgresql.org
Subject: Re: Declaring arrays in plpgsql functions
Date: Mon, 25 Mar 2002 14:37:02 -0500
Message-ID: <24133.1017085022@sss.pgh.pa.us> (raw)
In-Reply-To: <20020325100455.GD3337@shire>
References: <20020325100455.GD3337@shire>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, daniel@helena-daniel.se
Subject: Re: Declaring arrays in plpgsql functions
In-Reply-To: <24133.1017085022@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox