From: | Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Reported type mismatch improperly |
Date: | 2020-07-17 09:00:25 |
Message-ID: | CAKU4AWqLX3PDrTdhDabQ3o1Eogf1pCEznbUt6QYyEqmK3rHdsA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Currently when we call select_common_type, it compares the 2 exprs, if the
expr
type of both are unknown, it will be set to TEXTOID with some reasons, which
can cause the issue like below.
postgres=# select null union all select null union all select 1;
ERROR: UNION types text and integer cannot be matched
LINE 1: select null union all select null union all select 1;
In this case, we can't blame the user, they may want the nulls to be at
the top
of the result.
I worked on a patch to fix this, the main idea is before going to the above
logic, I peak all the exprs for a given column first, and choose a default
one
when we see the Unknown & Unknown case(rather than TextOid),
do you think it is ok?
--
Best Regards
Andy Fan
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Detect-the-null-type-correctly-in-setop-case-by-p.patch | application/octet-stream | 6.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jelte Fennema | 2020-07-17 10:39:31 | psql has some accessibility issues on Windows |
Previous Message | Thiede, Christoph | 2020-07-17 01:04:17 | AW: Stored columns: Unexpected varattno in expression to be mapped |