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

From: Rafal Dabrowa <fatwildcat(at)gmail(dot)com>
To: KraSer <kraser(at)gmail(dot)com>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: pl/pgsql errors when multi-dimensional arrays are used
Date: 2021-04-29 07:57:06
Message-ID: e485e255-f1db-b876-c377-2ad150c0d713@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

This also returns ERROR:  invalid input syntax for type integer:
"[221,222,223,224]"

On 4/29/2021 9:48 AM, KraSer wrote:
> try:
> a.fld1[1] = '[221,222,223,224]';
>
> чт, 29 апр. 2021 г. в 10:35, PG Doc comments form
> <noreply(at)postgresql(dot)org <mailto:noreply(at)postgresql(dot)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
>

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Pavel Stehule 2021-04-29 10:56:38 Re: pl/pgsql errors when multi-dimensional arrays are used
Previous Message KraSer 2021-04-29 07:48:42 Re: pl/pgsql errors when multi-dimensional arrays are used