BUG #16396: Parallel Union queries seem to treat NULL values differently

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #16396: Parallel Union queries seem to treat NULL values differently
Дата
Msg-id 16396-083a432fe7ac8fb9@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #16396: Parallel Union queries seem to treat NULL values differently  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16396
Logged by:          Stephan Teeuwen
Email address:      stephan@teeuwendesign.nl
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


В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16395: error when selecting generated column in a foreign table
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #16396: Parallel Union queries seem to treat NULL values differently