From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Thomas Swan <tswan(at)olemiss(dot)edu> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: UNIONS |
Date: | 2000-08-07 18:07:57 |
Message-ID: | 6928.965671677@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Thomas Swan <tswan(at)olemiss(dot)edu> writes:
> select id, null as text from foo union select id, name from foo_child;
> fails with
> unable to trasform {insert whatever type here} into unknown
> Each UNION | EXCEPT | INTERSECT clause must have compatible target
> types
The UNION type-resolution code could use some work; right now I think
the algorithm is to use the types of the first SELECT and force
everything else into that. A more symmetrical
promote-to-common-supertype approach would be nice. The UNION code is
such a mess that I haven't wanted to touch it until we do querytree
revisions in 7.2, though.
In the meantime, you should force the NULL to have the datatype you want
with something like "null::text" or "cast (null as text)". Note that
the way you have it above is only assigning a column label that happens
to be "text"; it's not a type coercion.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2000-08-07 18:13:08 | Re: Constraint stuff |
Previous Message | Don Baccus | 2000-08-07 18:05:10 | Re: mac.c |