BUG #15129: Problem with UNION/UNION ALL type setting when severalNULL values before defining the proper type

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #15129: Problem with UNION/UNION ALL type setting when severalNULL values before defining the proper type
Дата
Msg-id 152196085023.32649.9916472370480121694@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #15129: Problem with UNION/UNION ALL type setting when several NULL values before defining the proper type
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15129
Logged by:          Philippe BEAUDOIN
Email address:      phb07@apra.asso.fr
PostgreSQL version: 10.3
Operating system:   linux
Description:

While migrating a view from another RDBMS,I reached something that looks lie
a bug in postgres.
It concerns all supported postgres versions.
After a lot of simplification steps, I have a very simple test case that
reproduces the issue.

-- This statement works as expected: the type of the result column is
determined by the type of the first not null value
SELECT NULL
  UNION
SELECT 1::INT;

-- But with an additional NULL value, the statement fails with a message:
"UNION types text and integer cannot be matched"
SELECT NULL
  UNION
SELECT NULL
  UNION
SELECT 1::INT;

-- Adding an explicit cast on the first occurrence fixes the issue (I used
this trick as a workaround)
SELECT NULL::INT
  UNION
SELECT NULL
  UNION
SELECT 1::INT;


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

Предыдущее
От: Jaime Soler
Дата:
Сообщение: Re: Missed pgq_coop and pgq_ext in actual pgdg repository
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: BUG #15129: Problem with UNION/UNION ALL type setting when several NULL values before defining the proper type