BUG #8513: Error recognizing data type in union - Mailing list pgsql-bugs

From tommi.korhonen@thl.fi
Subject BUG #8513: Error recognizing data type in union
Date
Msg-id E1VTt3W-000456-Ca@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      8513
Logged by:          Tommi Korhonen
Email address:      tommi.korhonen@thl.fi
PostgreSQL version: 8.4.17
Operating system:   Redhat Linux
Description:

Example:


create table t1(a integer);
create table t2(b integer);
create table t3(c integer);


select null from t1
union all
select null from t2
union all
select c from t3;


produces an error


ERROR:  UNION types text and integer cannot be matched
LINE 5: select c from t3;


but


select null from t2
union all
select c from t3;


works correctly.


So it seems that if there are more than one nulls before field c in union
PostreSQL thinks merged field's data type is text.

pgsql-bugs by date:

Previous
From: Dhiraj Chawla
Date:
Subject: Getting "getsockopt(TCP_KEEPALIVE) failed" LOG message in PG Logs on Solaris 10
Next
From: Devrim GÜNDÜZ
Date:
Subject: Re: BUG #8500: Upgrade to postgis 2.1 breaks existing databases