Re: Why is a union of two null-results automatically casted to type text ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why is a union of two null-results automatically casted to type text ?
Дата
Msg-id 3328.1087323609@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Why is a union of two null-results automatically casted to type text ?  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Ответы Re: Why is a union of two null-results automatically casted to type text ?  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Список pgsql-general
Frank van Vugt <ftm.van.vugt@foxi.nl> writes:
>> UNION requires assignment of a definite type to the inputs, because
>> otherwise there's no certainty that we know how to identify distinct
>> and non-distinct values.  The alternative to assigning TEXT is to
>> reject the inner UNION outright :-(

> But in a UNION ALL the distinctiveness isn't an issue, is it?

True.  We do not currently distinguish UNION from UNION ALL as far as
datatype assignment rules go (INTERSECT/EXCEPT also act just the same).
In theory we could allow an output column of UNION ALL to remain
"unknown".  I'm not sure if it'd be a good idea to do so or not.  It'd
make this particular example work the way you want, but otherwise it
seems like making UNION ALL a special case would be a bit of a wart on
the type system.

            regards, tom lane

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

Предыдущее
От: "Scot L. Harris"
Дата:
Сообщение: Re: Installing 7.4.2
Следующее
От: elein
Дата:
Сообщение: postgresql.conf for pg_stat_activity