Re: Inconsistent cast to "char"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ian R(dot) Campbell" <ian(dot)campbell(at)thepathcentral(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Inconsistent cast to "char"
Date: 2021-12-02 21:31:23
Message-ID: 2216960.1638480683@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-12-03 07:59:21 BUG #17311: Google search results: Outdated docs at the top
Previous Message Tom Lane 2021-12-02 19:27:43 Re: Inconsistent cast to "char"