Re: Dereferencing a 2-dimensional array in plpgsql
| От | Tom Lane |
|---|---|
| Тема | Re: Dereferencing a 2-dimensional array in plpgsql |
| Дата | |
| Msg-id | 20625.1107192011@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Dereferencing a 2-dimensional array in plpgsql (Sven Willenberger <sven@dmv.com>) |
| Ответы |
Re: Dereferencing a 2-dimensional array in plpgsql
|
| Список | pgsql-general |
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
В списке pgsql-general по дате отправления: