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

Поиск
Список
Период
Сортировка
От Frank van Vugt
Тема Re: Why is a union of two null-results automatically casted to type text ?
Дата
Msg-id 200406151640.09703.ftm.van.vugt@foxi.nl
обсуждение исходный текст
Ответ на Re: Why is a union of two null-results automatically casted to type text ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Why is a union of two null-results automatically casted to type text ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> > 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 :-(

Ah, thanks Tom.

No, I think I'll go for the current implementation instead ;)

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

So why is this failing as well:
    select 1 union select * from (select null union all select null) as foo;

I strolled through chapters 8 and 10 of the docs ('data types' and 'type
conversion') earlier, is there some additional source of information that
describes the way PostgreSQL handles typing, specifically things like what
you're describing here? Other than the source that is...





--
Best,




Frank.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Why is a union of two null-results automatically casted to type text ?
Следующее
От: "Chris Ochs"
Дата:
Сообщение: Feature idea