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 441.1087306414@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 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:
> # select 1 union select * from (select null union select null) as foo;
> ERROR:  UNION types integer and text cannot be matched

> I'm wondering about the reason this cast to text takes place,

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 :-(

            regards, tom lane

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

Предыдущее
От: jseymour@linxnet.com (Jim Seymour)
Дата:
Сообщение: Re: [HACKERS] Release 7.4.3 branded
Следующее
От: Frank van Vugt
Дата:
Сообщение: Re: Why is a union of two null-results automatically casted to type text ?