Sven Willenberger <sven@dmv.com> writes:
> 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.
That isn't a two-dimensional array, it's a one-dimensional array with
some curly braces in the element values. Keep in mind that the number
of []s you write in the DECLARE is just decoration --- it's not enforced.
What's determining the actual array shape in this example is the
subscripts you write in the assignments.
regards, tom lane