Array assignment behavior (was Re: Stored procedure array limits)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Array assignment behavior (was Re: Stored procedure array limits)
Дата
Msg-id 16926.1159546451@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Stored procedure array limits  ("Paul B. Anderson" <paul.a@pnlassociates.com>)
Ответы Re: [GENERAL] Array assignment behavior (was Re: Stored procedure array limits)  (Casey Duncan <casey@pandora.com>)
Re: Array assignment behavior (was Re: Stored procedure array  ("Paul B. Anderson" <paul.a@pnlassociates.com>)
Список pgsql-admin
[ expanding this thread, as it now needs wider discussion ]

"Paul B. Anderson" <paul.a@pnlassociates.com> writes:
> Actually, I was not filling all of the arrays in sequential order.  I
> added code to initialize them in order and the function seems to be
> working now.  Is that a known problem?

Well, it's a documented behavior: section 8.10.4 saith

    A stored array value can be enlarged by assigning to an element
    adjacent to those already present, or by assigning to a slice
    that is adjacent to or overlaps the data already present.

Up to 8.2 we didn't have a lot of choice about this, because without any
ability to have nulls embedded in arrays, there wasn't any sane thing to
do with the intermediate positions if you assigned to an element not
adjacent to the existing range.  As of 8.2 we could allow assignment to
arbitrary positions by filling the intermediate positions with nulls.
The code hasn't actually been changed to allow that, but it's something
we could consider doing now.

Comments?

            regards, tom lane

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

Предыдущее
От: "Paul B. Anderson"
Дата:
Сообщение: Re: Stored procedure array limits
Следующее
От: Casey Duncan
Дата:
Сообщение: Re: [GENERAL] Array assignment behavior (was Re: Stored procedure array limits)