Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)

Поиск
Список
Период
Сортировка
On 04/02/2013 02:46 PM, Florian Pflug wrote:
> On Apr1, 2013, at 13:43 , Robert Haas <robertmhaas@gmail.com> wrote:
>> I don't think the current behavior is broken.  I found it
>> counterintuitive at first, but then I got used to it.  It's reasonably
>> self-consistent: arrays can't have empty dimensions, therefore the
>> empty array is unique and dimensionless.  Is that the behavior I would
>> have picked if I had designed the type?  No, it isn't.  I wouldn't
>> have tried to support one-dimensional arrays and multi-dimensional
>> arrays in the same data type either, nor would I have supported
>> non-default lower bounds.  But all of those ships have sailed, and the
>> time to change them is not after people have spent 10 years building
>> applications that work with the current behavior.  If we want to
>> introduce a new type with different, perhaps better, behavior, well, I
>> think that might be a fine idea.  But I *don't* think imposing a hard
>> compatibility break on users of arrays is a good idea.
> +1.
>
> Especially since having infinitely many variants of "empty" is IMHO
> hardly an improvement over the existing situation.
>
> If we're going to break compatibility, we should IMHO get rid of
> non-zero lower bounds all together. My guess is that the number of
> affected users wouldn't be much higher than for the proposed patch,
> and it'd allow lossless mapping to most language's native array types…


That would actually break a HUGE number of users, since the default
lower bound is 1. I have seen any number of pieces if code that rely on
that.

Doesn't the standard have something to say about all this?

cheers

andrew




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: in-catalog Extension Scripts and Control parameters (templates?)
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Typo in documentation for function to_json