Re: BUG #8226: Inconsistent unnesting of arrays

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: BUG #8226: Inconsistent unnesting of arrays
Дата
Msg-id 20130612110304.GA20851@depesz.com
обсуждение исходный текст
Ответ на Re: BUG #8226: Inconsistent unnesting of arrays  (Denis de Bernardy <ddebernardy@yahoo.com>)
Список pgsql-bugs
On Wed, Jun 12, 2013 at 12:19:51PM +0200, Denis de Bernardy wrote:
> Methinks the behavior should be consistent. It should always do one
> (presumably like in the first statement) or the other (which leads to
> undefined behavior in the first statement).

It is consistent. You just assume it does something else than what it
does.

It reads values from both sources, until both of them will at the same
time.
If any of them ends earlier, it is scanned again from beginning.

This can be seen, for example, with:

select unnest('{a,b,c,d,e,f}'::text[]), unnest('{1,2,3}'::text[]);

Or, perhaps better, with this one:

select unnest('{a,b,c,d,e,f}'::text[]), unnest('{1,2,3,4}'::text[]);

It doesn't show 6 rows (as first array), or 4 (as the other). or 24 (6
* 4). It shows 12, because this is the smallest common multiple of 6 and
4.

depesz

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: BUG #8226: Inconsistent unnesting of arrays
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: BUG #8226: Inconsistent unnesting of arrays