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

Поиск
Список
Период
Сортировка
От jian he
Тема Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint
Дата
Msg-id CACJufxECtm=EpiquvXhWKmP0x7-RNt5=qDuXJuuQkQ+6bOFXLA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint  (Srinath Reddy Sadipiralla <srinath2133@gmail.com>)
Список pgsql-hackers
On Sat, Dec 27, 2025 at 4:32 PM Srinath Reddy Sadipiralla
<srinath2133@gmail.com> wrote:
>>
>
> Yeah, I can easily reproduce this.
>
hi.

thinking about it more...
I tend to think it's not a bug.
because SET DATA TYPE changes the CHECK constraint definition.

>> 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;

At this stage, the constraint definition is no longer "a = b",
it becomes "(a::numeric = b::numeric)", which is different from "(a = b)".

sorry for the noise.



В списке pgsql-hackers по дате отправления: