pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ian R. Campbell <ian.campbell@thepathcentral.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Inconsistent cast to "char"
Date: Thu, 02 Dec 2021 16:31:23 -0500
Message-ID: <2216960.1638480683@sss.pgh.pa.us> (raw)
In-Reply-To: <2120116.1638473263@sss.pgh.pa.us>
References: <CAOC8YUcXymCMpC5d=7JvcwyjXPTT00WeebOM3UqTBreOD1N9hw@mail.gmail.com>
	<2117701.1638471036@sss.pgh.pa.us>
	<CAOC8YUfU9Ry_1oGoQ804aE3kZP8jBJ6+wXbhBkK1y6c547UPig@mail.gmail.com>
	<2120116.1638473263@sss.pgh.pa.us>

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





view thread (5+ messages)

Message-ID: <2216960.1638480683@sss.pgh.pa.us>
Permalink:  ../2216960.1638480683@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2216960.1638480683@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ian.campbell@thepathcentral.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Inconsistent cast to "char"
  In-Reply-To: <2216960.1638480683@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox