From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | phb07(at)apra(dot)asso(dot)fr |
Subject: | BUG #15129: Problem with UNION/UNION ALL type setting when several NULL values before defining the proper type |
Date: | 2018-03-25 06:54:10 |
Message-ID: | 152196085023.32649.9916472370480121694@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15129
Logged by: Philippe BEAUDOIN
Email address: phb07(at)apra(dot)asso(dot)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;
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2018-03-25 08:50:40 | Re: BUG #15129: Problem with UNION/UNION ALL type setting when several NULL values before defining the proper type |
Previous Message | Jaime Soler | 2018-03-23 09:14:30 | Re: Missed pgq_coop and pgq_ext in actual pgdg repository |