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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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

# create table xxx (a int[]);
# update xxx set a[2:] = '{1,2}';
# 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

In response to


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