Re: ERROR: array subscript out of range

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ERROR: array subscript out of range
Дата
Msg-id 261.1239394724@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ERROR: array subscript out of range  (chinchu2005 <chinchu2005@gmail.com>)
Список pgsql-general
chinchu2005 <chinchu2005@gmail.com> writes:
> declare
> i integer;
> j integer;
> a integer[][];
> begin
> for i in 1..10 loop
> for j in 1..2 loop
> a[i][j]:=i*j;

This isn't going to work --- it implies dynamically resizing the array,
and plpgsql isn't smart enough to do that for a multidimensional array.
Do you actually need a 2-D array here?  If so you'll have to initialize
it to the right dimensions to start with, eg with
    a := '{{1,2,3,4,5,6,7,8,9,10},{1,2,3,4,5,6,7,8,9,10}}';

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: chinchu2005
Дата:
Сообщение: ERROR: array subscript out of range
Следующее
От: Pedro Doria Meunier
Дата:
Сообщение: Re: Internationalization