Reported type mismatch improperly - Mailing list pgsql-bugs

From Andy Fan
Subject Reported type mismatch improperly
Date
Msg-id CAKU4AWqLX3PDrTdhDabQ3o1Eogf1pCEznbUt6QYyEqmK3rHdsA@mail.gmail.com
Whole thread Raw
Responses Re: Reported type mismatch improperly
List 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

pgsql-bugs by date:

Previous
From: "Thiede, Christoph"
Date:
Subject: AW: Stored columns: Unexpected varattno in expression to be mapped
Next
From: Jelte Fennema
Date:
Subject: psql has some accessibility issues on Windows