Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint - Mailing list pgsql-hackers

From Srinath Reddy Sadipiralla
Subject Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint
Date
Msg-id CAFC+b6ry2Q20K1LYhUK6bW8YsYFouJVeMfQBUHPFvkOCFmoLnA@mail.gmail.com
Whole thread Raw
In response to bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
Hi Jian,

On Sat, Dec 27, 2025 at 1:28 PM jian he <jian.universality@gmail.com> wrote:
hi.

while working on let ALTER COLUMN SET DATA TYPE cope with trigger dependency.
I found this bug, it involves several ALTER COLUMN SET DATA TYPE calls.

DROP TABLE IF EXISTS main_table;
CREATE TABLE main_table (a int, b int, check(a = b));
ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE numeric;
ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE int;
ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE text;
ALTER TABLE main_table ALTER COLUMN b SET DATA TYPE text;
INSERT INTO main_table VALUES ('a', 'a');

This also applies to statistics, indexes. for statistics: the error is only
observable after running ANALYZE manually.

Yeah, I can easily reproduce this. 

--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/

pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint
Next
From: "cca5507"
Date:
Subject: Missing oauth_validator_libraries in variable_is_guc_list_quote()