Re: Some questions about the array.

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: YUriy Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some questions about the array.
Date: 2015-11-27 14:23:35
Message-ID: 56586767.6040205@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Some comments about patch
1
Documentation isn't very informative
Outputs of
SELECT schedule[:][:] FROM sal_emp WHERE name = 'Bill'
and
SELECT schedule[:2][1:] FROM sal_emp WHERE name = 'Bill';
are the same. Suppose, it's better to have differs ones.

2
# create table xxx (a int[]);
# update xxx set a[2:] = '{1,2}';
UPDATE 0
# update xxx set a[2:] = '{1,2}';
ERROR: cannot determine upper index for empty array
# update xxx set a[:2] = '{1,2}';
ERROR: invalid input syntax for integer: "{1,2}"
# update xxx set a[:] = '{1,2}';
ERROR: invalid input syntax for integer: "{1,2}"

Seems, error messages are too inconsistent. If you forbid omitting bound in
assigment then if all cases error message should be the same or close.

YUriy Zhuravlev wrote:
> Hello again.
> I attached simple patch for omitted boundaries in the slice.
> This will simplify the writing of SQL. Instead:
> select arr[2:array_upper(arr, 1)];
> you can write:
> select arr[2:];
>
> simple and elegant.
> Omitted boundaries is prohibited in UPDATE.
>
> Thanks.
>
>
>
>

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2015-11-27 14:42:31 Re: Use pg_rewind when target timeline was switched
Previous Message Tomas Vondra 2015-11-27 14:02:38 Re: silent data loss with ext4 / all current versions