Re: Possible marginally-incompatible change to array subscripting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Yury Zhuravlev <u(dot)zhuravlev(at)postgrespro(dot)ru>
Subject: Re: Possible marginally-incompatible change to array subscripting
Date: 2015-12-22 17:55:16
Message-ID: 26587.1450806916@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Dec 22, 2015 at 11:51 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> ISTM that if we'd had Yury's code in there from the beginning, what we
>> would define this as meaning is "a[3:4][:5]", ie the implied range runs
>> from whatever the array lower bound is up to the specified subscript.

> Gosh, our arrays are strange. I would have expected a[3:4][5] to mean
> a[3:4][5:5].

Yeah, probably, now that you mention it ... but that seems like too much
of a compatibility break. Or does anyone want to argue for just doing
that and never mind the compatibility issues? This is a pretty weird
corner case already; there can't be very many people relying on it.

Another point worth realizing is that the implicit insertion of "1:"
happens in the parser, meaning that existing stored views/rules will dump
out with that added and hence aren't going to change meaning no matter
what we decide here.

(BTW, now that I've read the patch a bit further, it actually silently
changed the semantics as I'm suggesting already. We could undo that
without too much extra code, but I feel that we shouldn't. Robert's
idea seems like a plausible alternative, but it would take a nontrivial
amount of code to implement it unless we are willing to double-evaluate
such a subscript.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-12-22 18:01:43 Re: Possible marginally-incompatible change to array subscripting
Previous Message Robert Haas 2015-12-22 17:51:12 Re: Let PostgreSQL's On Schedule checkpoint write buffer smooth spread cycle by tuning IsCheckpointOnSchedule?