Re: BUG #2694: Memory allocation error when selecting array

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2694: Memory allocation error when selecting array
Дата
Msg-id 28615.1161194916@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #2694: Memory allocation error when selecting array  (Joe Conway <mail@joeconway.com>)
Ответы Re: BUG #2694: Memory allocation error when selecting array  (Joe Conway <mail@joeconway.com>)
Список pgsql-bugs
Joe Conway <mail@joeconway.com> writes:
> Sorry for the slow response -- I'm at the airport just heading home from
> a marathon 30 day business trip.

Yow.  Hope you get some time off...

> Tom Lane wrote:
>> "Vitali Stupin" <Vitali.Stupin@ria.ee> writes:
>>> The error "invalid memory alloc request size 4294967293" apears when
>>> selecting array of empty arrays:
>>> select ARRAY['{}'::text[],'{}'::text[]];
>>
>> Joe, what do you think about this?  Offhand I think that the only
>> workable definition is that this case yields another zero-dimensional
>> array, but maybe there is another choice?

> I think producing another zero-dimensional result is the only way that
> makes sense unless/until we change multidimensional arrays to really be
> arrays of array-datatype elements. Right now they're two different things.

On looking at the code, I notice that this somewhat-related case works:

regression=# select array[null::text[], null::text[]];
 array
-------
 {}
(1 row)

The reason is that null inputs are just ignored in ExecEvalArray.  So
one pretty simple patch would be to ignore zero-dimensional inputs too.
This would have implications for mixed inputs though: instead of

regression=# select array['{}'::text[], '{a,b,c}'::text[]];
ERROR:  multidimensional arrays must have array expressions with matching dimensions

you'd get behavior like

regression=# select array[null::text[], '{a,b,c}'::text[]];
   array
-----------
 {{a,b,c}}
(1 row)

Which of these seems more sane?

            regards, tom lane

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

Предыдущее
От: Franz.Rasper@izb.de
Дата:
Сообщение: Re: corruption since 7.4.13 update ?
Следующее
От:
Дата:
Сообщение: Re: 8.2beta1 (w32): server process crash (tsvector)