Re: pl/pgsql errors when multi-dimensional arrays are used

Поиск
Список
Период
Сортировка
От KraSer
Тема Re: pl/pgsql errors when multi-dimensional arrays are used
Дата
Msg-id CAFYWJW2TL-Mh+2-OJXc5beGe0LLWqVsMbxfuKGus6BvRDnA5Rw@mail.gmail.com
обсуждение исходный текст
Ответ на pl/pgsql errors when multi-dimensional arrays are used  (PG Doc comments form <noreply@postgresql.org>)
Ответы Re: pl/pgsql errors when multi-dimensional arrays are used  (Rafal Dabrowa <fatwildcat@gmail.com>)
Список pgsql-docs
try:
a.fld1[1] = '[221,222,223,224]';

чт, 29 апр. 2021 г. в 10:35, PG Doc comments form <noreply@postgresql.org>:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/arrays.html
Description:

I have PostgreSQL 13. Let's declare the type below, then use it in
pl/pgsql:

create type typ1 as (
        fld1 int[][]
);

do $$
        declare
           a typ1;
        begin
                a.fld1 = '{{121,122,123,124}}';         -- OK                   (1)
                a.fld1[1] = '{221,222,223,224}';                -- fails                (2)
                a.fld1[1][1] = 321;                                     -- OK                   (3)
                a.fld1[1][2] = 322;                                     -- OK unless line (1) is removed
        end;
$$;

In line (2) the plql reports ERROR:  invalid input syntax for type integer:
"{221,222,223,224}"
When lines (1) and (2) are removed, psql reports ERROR:  array subscript out
of range

Is this expected behavior? Why?

Rafal

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

Предыдущее
От: PG Doc comments form
Дата:
Сообщение: pl/pgsql errors when multi-dimensional arrays are used
Следующее
От: Rafal Dabrowa
Дата:
Сообщение: Re: pl/pgsql errors when multi-dimensional arrays are used