Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
От | Tom Lane |
---|---|
Тема | Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL) |
Дата | |
Msg-id | 13056.1364439675@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL) (Dean Rasheed <dean.a.rasheed@gmail.com>) |
Ответы |
Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re:
Should array_length() Return NULL)
|
Список | pgsql-hackers |
Dean Rasheed <dean.a.rasheed@gmail.com> writes: > On 28 March 2013 00:04, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> Yeah, if '[1:1]={0}'::int[] is distinct from '[2:2]={0}'::int[], >> it's a bit hard to argue that '[1:0]={}'::int[] must not be >> distinct from '[2:1]={}'::int[]. > You could make the exact same argument for ranges --- if > '[1,1]'::int4range is distinct from '[2,2]'::int4range, why isn't > '[1,1)'::int4range distinct from '[2,2)'::int4range? Because an array's bounds are a core piece of the identity of the array. In another universe PG's arrays might not have been defined like that, but as things stand, they are. We chose to define ranges differently. That's okay, because ranges *are not arrays*. If they were the same, we'd not have needed to invent a separate concept. > I see ranges and arrays as very closely related because the extents of > an array are an integer range, and the extents of an empty array are > an empty range. Moreover, they have almost identical API functions. I think this argument has about as much validity as claiming that because the subscripts of an array are integers, arrays should behave like integers. regards, tom lane
В списке pgsql-hackers по дате отправления: