Possible marginally-incompatible change to array subscripting
От
Tom Lane
Тема
Possible marginally-incompatible change to array subscripting
Дата
Msg-id
24637.1450803087@sss.pgh.pa.us
Список
Дерево обсуждения
Possible marginally-incompatible change to array subscripting Tom Lane <tgl@sss.pgh.pa.us>
Re: Possible marginally-incompatible change to array subscripting Yury Zhuravlev <u.zhuravlev@postgrespro.ru>
Re: Possible marginally-incompatible change to array subscripting Tom Lane <tgl@sss.pgh.pa.us>
Re: Possible marginally-incompatible change to array
subscripting Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: Possible marginally-incompatible change to array subscripting Tom Lane <tgl@sss.pgh.pa.us>
Re: Possible marginally-incompatible change to array subscripting Robert Haas <robertmhaas@gmail.com>
Re: Possible marginally-incompatible change to array subscripting Tom Lane <tgl@sss.pgh.pa.us>
Re: Possible marginally-incompatible change to array subscripting Robert Haas <robertmhaas@gmail.com>
Re: Possible marginally-incompatible change to array
subscripting "Joshua D. Drake" <jd@commandprompt.com>
Re: Possible marginally-incompatible change to array subscripting Pavel Stehule <pavel.stehule@gmail.com>
Re: Possible marginally-incompatible change to array subscripting Tom Lane <tgl@sss.pgh.pa.us>
I'm reviewing Yury Zhuravlev's patch to allow array slice boundaries to be omitted, for example "a[4:]" means "the slice extending from element 4 to the last element of a". It strikes me that there's an improvement we could easily make for the case where a mixture of slice and non-slice syntax appears, that is something like "a[3:4][5]". Now, this has always meant a slice, and the way we've traditionally managed that is to treat simple subscripts as being the range upper bound with a lower bound of 1; that is, what this example means is exactly "a[3:4][1:5]". 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. This would make no difference of course for the common case where the array lower bound is 1, but it seems a lot less arbitrary when it isn't. So I think we should strongly consider changing it to mean that, even though it would be non-backwards-compatible in such cases. Comments? regards, tom lane
В списке pgsql-hackers по дате отправления