Skip site navigation (1) Skip section navigation (2)

Re: UNION with more than 2 branches

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: UNION with more than 2 branches
Date: 2007-04-24 18:23:00
Message-ID: 877is18we3.fsf@oxford.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-hackers
"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
>
>> Does it even matter except in the case of nulls? I mean, if the inner pair
>> uses integer and then the outer pair uses bigint it'll still work correctly,
>> no?
>
> Oh, it absolutely matters: you can get different answers.  Consider
>
> 	(select '1' union select ' 1') union all select 1;

Ah.

>> What would happen if the inner pair defaulted null to "unknown" instead of
>> text?
>
> You're missing the point, which is that the inner UNION needs to decide
> what its uniqueness semantics are, independently of what might happen to
> its result later.  Or that's how I read the spec anyway.

Ah of course. We wouldn't be able to unionize "unknown" all. hmph.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com


In response to

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2007-04-24 18:23:12
Subject: Re: UNION with more than 2 branches
Previous:From: Tom LaneDate: 2007-04-24 18:19:30
Subject: Re: [HACKERS] Full page writes improvement, code update

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group