Re: BUG #11304: UNION query with NULL values fails - Mailing list pgsql-bugs

From David G Johnston
Subject Re: BUG #11304: UNION query with NULL values fails
Date
Msg-id 1409325370266-5816904.post@n5.nabble.com
Whole thread Raw
In response to Re: BUG #11304: UNION query with NULL values fails  (Mike Porter <mike@udel.edu>)
Responses Re: BUG #11304: UNION query with NULL values fails
List 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.

pgsql-bugs by date:

Previous
From: Mike Porter
Date:
Subject: Re: BUG #11304: UNION query with NULL values fails
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #11264: Auto vacuum wraparound job blocking everything