Re: Bad behavior from plpython 'return []'

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: Bad behavior from plpython 'return []'
Дата
Msg-id 6449df87-e606-e6a4-e25d-42ce6ffb78d9@BlueTreble.com
обсуждение исходный текст
Ответ на Re: Bad behavior from plpython 'return []'  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 7/1/16 2:52 PM, Tom Lane wrote:
> +    /* if caller tries to specify zero-length array, make it empty */
> +    if (nelems <= 0)
> +        return construct_empty_array(elmtype);
> +
>     /* compute required space */
>     nbytes = 0;
>     hasnulls = false;
>
> But that might introduce new problems too, if any callers expect the
> array dimensions to be exactly what they asked for.

You mean ndims? What if instead of an empty array it returned an array 
where *dims was just all zeros (and correctly set *lbs)? array_eq would 
still need to account for that, but I think we don't have a choice about 
that unless we expressly forbid arrays where any of the elements of 
*dims were 0 (which I suspect we should probably do anyway... I don't 
see how you can do anything with a 2x0x3 array...)
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bad behavior from plpython 'return []'
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Reviewing freeze map code