Dereferencing a 2-dimensional array in plpgsql

From: Sven Willenberger <sven(at)dmv(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Dereferencing a 2-dimensional array in plpgsql
Date: 2005-01-31 15:33:28
Message-ID: 41FE4FC8.60903@dmv.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am having an issue with trying to dereference a 2-dimensional array in
plpgsql. The idea is to have an setup like:

DECLARE
myarray varchar[][];
myvar char;
BEGIN
--stuff
myarray[1] := ''{value1,value2,value3}'';
myarray[2] := ''{valuea,valueb,valuec}'';

--If I then:

myvar := array[1][1];

--I get a subscript error generated. I have tried everycombination of
array[1:1][1], etc all to no avail.

I have also tried pre-initializing myarray with
myarray := ''{{}}'';

The docs seem to to indicate that a simple myarray[1][2] for example
should work, but that does not hold true in the plpgsql. Is there
another type of initialization that is needed to be done? Any advice?

Sven

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Abdul-Wahid Paterson 2005-01-31 16:02:31 Re: Postgresql and Athlon64 ?
Previous Message Együd Csaba 2005-01-31 15:30:12 Re: Howto determin the number of elemnts of an array