Re: Some questions about the array. - Mailing list pgsql-hackers

From Teodor Sigaev
Subject Re: Some questions about the array.
Date
Msg-id 56586767.6040205@sigaev.ru
Whole thread Raw
In response to Re: Some questions about the array.  (YUriy Zhuravlev <u.zhuravlev@postgrespro.ru>)
Responses Re: Some questions about the array.  (YUriy Zhuravlev <u.zhuravlev@postgrespro.ru>)
List 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@sigaev.ru
  WWW: http://www.sigaev.ru/
 



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: silent data loss with ext4 / all current versions
Next
From: Teodor Sigaev
Date:
Subject: Re: Use pg_rewind when target timeline was switched