PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16396
PG Version12.2
OSMac 10.15.3
Opened2020-04-27 15:26:59+00
Reported byStephan Teeuwen
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16396
Logged by:          Stephan Teeuwen
Email address:      (redacted)
PostgreSQL version: 12.2
Operating system:   Mac 10.15.3
Description:        

We recently upgraded from PG 9.5 to PG 12.2 and encountered the following
error message: "ERROR:  UNION types integer and text cannot be matched"

Even though docs state that if the left side of the join is defined. the
right side type should not have been defined: 
https://www.postgresql.org/docs/12/typeconv-union-case.html

This query fits the documented on above url:
SELECT CAST(NULL AS INTEGER) AS hello_world
	UNION
SELECT NULL AS hello_world

But as in our query the following happened:
SELECT hello_world
FROM (SELECT CAST(NULL AS INTEGER) AS hello_world) as a
	UNION
SELECT hello_world
FROM (SELECT NULL AS hello_world) as b

It fails and is only fixable by defining the NULL in the right side of the
UNION as CAST(NULL AS INTEGER)

Which wasn't required on Postgres 9.5, but is required for sure on Postgres
12.2
I'm unsure which version introduced this different, but it would be good to
have it represented in the documentation mentioned above!

King regards, 
Stephan Teeuwen

Messages

DateAuthorSubject
2020-04-27 15:26:59+00PG Bug reporting formBUG #16396: Parallel Union queries seem to treat NULL values differently
2020-04-27 15:57:35+00"David G(dot) Johnston"Re: BUG #16396: Parallel Union queries seem to treat NULL values differently
2020-04-27 16:40:52+00Tom LaneRe: BUG #16396: Parallel Union queries seem to treat NULL values differently