Re: Inconsistent behavior on Array & Is Null?

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Inconsistent behavior on Array & Is Null?
Дата
Msg-id 877jwykwhe.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: Inconsistent behavior on Array & Is Null?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> That would break even more things, no?
> 
> On the other hand, it'd get rid of the problem that we presently face
> with dump/restore of arrays that don't have lower bound 1.  Because
> pg_dump doesn't do anything to mark such values, they'll end up with
> lower bound 1 after reload anyway.  The fact that we haven't heard lots
> of squawks about that suggests to me that not many people are using such
> arrays at present ...

You have to be using not only arrays, but the new 7.4 functions provided to
manipulate them. In fact I think you have to be using array_prepend
specifically. But even there since it's not a mutator it's really not that
surprising that the elements of the brand new array it's returning should have
new indexes.

In fact I suspect there are more people with hidden bugs where they depend on
arrays starting at 1. This type of bug is insidious since it's hard to test
for, your application might never generate an array with a lower bound other
than 1 until someone adds some new code using array_prepend somewhere and all
of the sudden you get strange behaviours from unrelated code.

I can have the honour of being the first squawker like you describe, but my
problem was only evidence that having such non-normalized arrays at all was
surprising. I was using int_aggregate.c which generates non-standard arrays
with lower bounds of 0. My code assumed array_upper()+1 == length. After I
dumped and restored all my counts were off by one.

-- 
greg



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

Предыдущее
От: jseymour@LinxNet.com (Jim Seymour)
Дата:
Сообщение: Re: Problems Vacuum'ing
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Better support for whole-row operations and composite types