Re: BUG #11304: UNION query with NULL values fails

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11304: UNION query with NULL values fails
Date: 2014-08-29 15:16:10
Message-ID: 1409325370266-5816904.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Mike Porter wrote
> On Thu, 28 Aug 2014,

> m.woehling@

> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference: 11304
>> Logged by: Markus Woehling
>> Email address:

> m.woehling@

>> PostgreSQL version: 9.3.5
>> Operating system: Windows Server 2008
>> Description:
>>
>
> select c1 :: integer from (select null as c1 union all select null as c1
> union all select 1 :: text as c1) x;
> c1
> ----
>
>
> 1
> (3 rows)
>
> select c1 :: integer +1 from (select null as c1 union all select null as
> c1 union all select 1 :: text as c1) x;
> ?column?
> ----------
>
>
> 2
> (3 rows)
>
>
> (I hate NULL. Just felt like I needed to say that.)
>
> The above example was run on a 9.2.3 server.

Do you have a conclusion/observation to make?

NULL + NOT-NULL => NULL

Furthermore, since null is valid input for any type, explicit casting
between types, if such a cast exists, will always succeed and will always
result in null.

I agree there is potential for compatibility improvement here but I don't
see where your observation fits in.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-11304-UNION-query-with-NULL-values-fails-tp5816830p5816904.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dinesh Bhandary 2014-08-29 19:09:40 Re: BUG #11264: Auto vacuum wraparound job blocking everything
Previous Message Mike Porter 2014-08-29 14:35:46 Re: BUG #11304: UNION query with NULL values fails