Hi all,
Boiling down a problem in one of my queries, I noticed this behaviour.
# select version();
version
------------------------------------------------------------------------
PostgreSQL 7.4.2 on i586-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
(1 row)
# select 1 union all select '2';
?column?
----------
1
2
(2 rows)
# select 1 union select null;
?column?
----------
1
(2 rows)
# select 1 union select * from (select null union select null) as foo;
ERROR: UNION types integer and text cannot be matched
I guess the last one fails because the second union of two unknown(?) types
gets casted to text, which in turn cannot be processed by the UNION while the
left part is of type integer.
I'm wondering about the reason this cast to text takes place, is this simply
because SQL specs say so?
--
Best,
Frank.