Re: UNION with more than 2 branches

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: UNION with more than 2 branches
Дата
Msg-id 877is18we3.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: UNION with more than 2 branches  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <stark@enterprisedb.com> writes:
>
>> Does it even matter except in the case of nulls? I mean, if the inner pair
>> uses integer and then the outer pair uses bigint it'll still work correctly,
>> no?
>
> Oh, it absolutely matters: you can get different answers.  Consider
>
>     (select '1' union select ' 1') union all select 1;

Ah.

>> What would happen if the inner pair defaulted null to "unknown" instead of
>> text?
>
> You're missing the point, which is that the inner UNION needs to decide
> what its uniqueness semantics are, independently of what might happen to
> its result later.  Or that's how I read the spec anyway.

Ah of course. We wouldn't be able to unionize "unknown" all. hmph.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCHES] Full page writes improvement, code update
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: UNION with more than 2 branches