pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Teodor Sigaev <teodor@sigaev.ru>
To: YUriy Zhuravlev <u.zhuravlev@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Subject: Re: Some questions about the array.
Date: Fri, 4 Dec 2015 16:52:48 +0300
Message-ID: <56619AB0.2070802@sigaev.ru> (raw)
In-Reply-To: <1538864.xaPm21N10Q@dinodell>
References: <2987745.PueTkqGxbO@dinodell>
	<565D92F7.5000505@sigaev.ru>
	<1899635.M2QZgB1EhQ@dinodell>
	<1538864.xaPm21N10Q@dinodell>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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@sigaev.ru
                                                    WWW: http://www.sigaev.ru/


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (56+ messages)  latest in thread

Message-ID: <56619AB0.2070802@sigaev.ru>
Permalink:  ../56619AB0.2070802@sigaev.ru/
Also on:    postgresql.org/message-id/56619AB0.2070802@sigaev.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: teodor@sigaev.ru, u.zhuravlev@postgrespro.ru
  Subject: Re: Some questions about the array.
  In-Reply-To: <56619AB0.2070802@sigaev.ru>
  References: <2987745.PueTkqGxbO@dinodell> <565D92F7.5000505@sigaev.ru> <1899635.M2QZgB1EhQ@dinodell> <1538864.xaPm21N10Q@dinodell> <56619AB0.2070802@sigaev.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox