BUG #8513: Error recognizing data type in union

From: tommi(dot)korhonen(at)thl(dot)fi
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8513: Error recognizing data type in union
Date: 2013-10-09 12:39:58
Message-ID: E1VTt3W-000456-Ca@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 8513
Logged by: Tommi Korhonen
Email address: tommi(dot)korhonen(at)thl(dot)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.

Browse pgsql-bugs by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2013-10-09 14:54:48 Re: BUG #8500: Upgrade to postgis 2.1 breaks existing databases
Previous Message Dhiraj Chawla 2013-10-09 07:29:03 Getting "getsockopt(TCP_KEEPALIVE) failed" LOG message in PG Logs on Solaris 10