Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint

From: Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint
Date: 2025-12-27 08:32:26
Message-ID: CAFC+b6ry2Q20K1LYhUK6bW8YsYFouJVeMfQBUHPFvkOCFmoLnA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Jian,

On Sat, Dec 27, 2025 at 1:28 PM jian he <jian(dot)universality(at)gmail(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message cca5507 2025-12-27 09:52:59 Missing oauth_validator_libraries in variable_is_guc_list_quote()
Previous Message jian he 2025-12-27 07:58:06 bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint