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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2694: Memory allocation error when selecting array
Дата
Msg-id 28073.1162837717@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #2694: Memory allocation error when selecting array  (Joe Conway <mail@joeconway.com>)
Список pgsql-bugs
Joe Conway <mail@joeconway.com> writes:
> ... But as I've opined before, all of this seems to me to be much cleaner if
> arrays were always one-dimensional, and array elements could also be
> nested arrays (per SQL 2003). If we said that the cardinality of the
> nested array is an integral part of the datatype, then I think you would
> have:

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

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

> So maybe this is the behavior we should shoot for now?

Perhaps that's something to think about for 8.3, but it's clearly
infeasible for 8.2, to say nothing of the back branches.  What I've
just committed does this:

* if all inputs are empty arrays, return an empty array (instead of failing)

* if mix of empty and nonempty arrays, raise error (same as before)

The case of NULL subarrays is a bit weird.  In the back branches the
ARRAY[] construct was strict and would return a NULL array if any input
was NULL; I think it would be a bad idea to change that.  The HEAD code
was simply skipping over NULL subarrays, which seemed like a good idea
at the time but on reflection is not so hot.  What I've done is to make
it treat NULL subarrays as if they were empty subarrays.

            regards, tom lane

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

Предыдущее
От: "Alon Goldshuv"
Дата:
Сообщение: BUG #2740: gcc bug on intel mac with postgresql -O3 optimized build
Следующее
От: "Mason Hale"
Дата:
Сообщение: BUG #2739: INTERSECT ALL not working