I wrote:
> To be clear, the change I'm thinking of would result in errors, not in
> silently applying the int4 cast. As a quick-n-dirty test:
> regression=# update pg_type set typcategory = 'x' where typname = 'char';
> UPDATE 1
> regression=# select 1::int8::"char", 1::int4::"char", 1::int2::"char";
> ERROR: cannot cast type bigint to "char"
> LINE 1: select 1::int8::"char", 1::int4::"char", 1::int2::"char";
> ^
It turns out that changing the typcategory does have some undesirable
side-effects, but I found another possible workaround. Patch
posted at [1].
regards, tom lane
[1] https://www.postgresql.org/message-id/2216388.1638480141%40sss.pgh.pa.us