Received: from nw-smtp.wineasy.se (nw-smtp-02.wineasy.se [195.42.210.227]) by postgresql.org (Postfix) with ESMTP id 3B8AA475A88 for ; Mon, 25 Mar 2002 05:04:54 -0500 (EST) Received: from shire (202.234.88.213.host.songnetworks.se [213.88.234.202]) by nw-smtp.wineasy.se (Postfix) with ESMTP id 9EFFB3FB10 for ; Mon, 25 Mar 2002 11:04:55 +0100 (CET) Received: from dl by shire with local (Exim 3.34 #1 (Debian)) id 16pRLT-00017Y-00 for ; Mon, 25 Mar 2002 11:04:55 +0100 Date: Mon, 25 Mar 2002 11:04:55 +0100 From: Daniel Lundin To: pgsql-sql@postgresql.org Subject: Declaring arrays in plpgsql functions Message-ID: <20020325100455.GD3337@shire> Mail-Followup-To: pgsql-sql@postgresql.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.27i Organization: Helena & Daniel AB X-Archive-Number: 200203/308 X-Sequence-Number: 7187 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: create function reservationIds(int4) returns text[][] as ' declare paramOriginalResNr alias for $1; rs record; id_src text[][]; begin for rs in select src, id from ReservationId where originalResNr = paramOriginalResNr loop text[array_dim(text) + 1][0] := rs.src; text[array_dim(text) + 1][1] := rs.id; end loop; return id_src; end; ' language 'plpgsql'; , but when I select the function the parser complains: 'ERROR: parse error at or near "["'. It seems to be the id_src declaration that's not correct; the returns text[][] works. I've tried text[2][30] to the same effect. /Daniel