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-12-04 13:52:48
Message-ID: 56619AB0.2070802@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Some inconsistency (if we believe that omitted lower bound is equal to 1):
regression=# insert into arrtest_s values
('[-1:9]={3,1,4,1,5,9,5,6,7,8,9}'::int[], null);
INSERT 0 1
regression=# UPDATE arrtest_s SET a[:2] = '{23, 24, 25}';
ERROR: source array too small
regression=# UPDATE arrtest_s SET a[1:2] = '{23, 24, 25}';
UPDATE 1

Seems, omitting boundaries in insert/update isn't a good idea. I suggest to
allow omitting only in select subscripting.

YUriy Zhuravlev wrote:
> On Tuesday 01 December 2015 15:43:47 you wrote:
>> On Tuesday 01 December 2015 15:30:47 Teodor Sigaev wrote:
>>> As I understand, update should fail with any array, so, first update
>>> should
>>> fail too. Am I right?
>>
>> You right. Done. New patch in attach.
>
> Found error when omitted lower bound in INSERT like this:
> INSERT INTO arrtest_s (a[:2], b[1:2]) VALUES ('{1,2,3,4,5}', '{7,8,9}');
>
> I fix it in new patch. Lower bound for new array is 1 by default.
>
> 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 Ildus Kurbangaliev 2015-12-04 14:17:26 Re: Support of partial decompression for datums
Previous Message Craig Ringer 2015-12-04 13:50:09 Re: Logical replication and multimaster