Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 9E34F475AF0 for ; Mon, 25 Mar 2002 14:37:09 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g2PJb2S24136; Mon, 25 Mar 2002 14:37:02 -0500 (EST) To: Daniel Lundin Cc: pgsql-sql@postgresql.org Subject: Re: Declaring arrays in plpgsql functions In-reply-to: <20020325100455.GD3337@shire> References: <20020325100455.GD3337@shire> Comments: In-reply-to Daniel Lundin message dated "Mon, 25 Mar 2002 11:04:55 +0100" Date: Mon, 25 Mar 2002 14:37:02 -0500 Message-ID: <24133.1017085022@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200203/320 X-Sequence-Number: 7197 Daniel Lundin 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