Re: Array behavior oddities
От | Bruce Momjian |
---|---|
Тема | Re: Array behavior oddities |
Дата | |
Msg-id | 200801151504.m0FF4kg06253@momjian.us обсуждение исходный текст |
Ответ на | Re: Array behavior oddities (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Array behavior oddities
|
Список | pgsql-hackers |
Tom Lane wrote: > Bruce Momjian <bruce@momjian.us> writes: > > If any dimension is written as a slice, i.e. contains a colon, then all > > dimensions are treated as slices. > > > Is the the behavior of assuming an entry with no colon is a slice what > > we want, or are we just stuck with it? > > Why do you find that surprising? It's either a slice or it isn't, > there's no halfway point. Are you proposing to throw an error if only > some of the subscripts have colons? What would be the point? What is confusing is if I see [1:3][2], I assume that is [1:3][2:2], not[1:3][1:2]. By what logic does [2] mean from 1 to2? For example, in [1:3][2], [2] means [1:2], two elements, but in [1][2],[2] means one element. > > Is there a reason out-of-bounds array accesses behave differently for > > slices and non-slices? > > History (although "sloppy original implementation" would do too). I'm > not sure if we should try to clean it up --- there've not been that many > complaints, but I'm sure we'd get complaints from people whose code > stopped working, if we change it. OK, so there is no grand design I am missing; it is just a wart in our implementation, that at least we document. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://postgres.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
В списке pgsql-hackers по дате отправления: