Re: 42P16 error when dropping and adding column

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Manuel Reyes Bravo <manuelreyesbravo(at)gmail(dot)com>
Cc: Ludvig Janiuk <ludvig(dot)janiuk(at)proton(dot)me>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: 42P16 error when dropping and adding column
Date: 2026-09-28 17:00:04
Message-ID: CAHGQGwGPJNq_p8w5W9jvA__6GOmFk5A0K7Vxw3ab0ASotvQy3g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Sep 18, 2026 at 12:01 AM Manuel Reyes Bravo
<manuelreyesbravo(at)gmail(dot)com> wrote:
> v1's test covers the DROP COLUMN form only. The attached top-up adds
> the three commands above to the same place in alter_table.sql.

Thanks! Attached is v2 patch, which includes your tests.

While working with the v1 patch, I found that the following DDL failed even
though it succeeds without the patch. v2 fixes this regression introduced by
v1.

CREATE TABLE t (id int NOT NULL);
ALTER TABLE t
ALTER COLUMN id DROP NOT NULL,
ADD PRIMARY KEY (id),
ADD CONSTRAINT hoge NOT NULL id;

Regards,

--
Fujii Masao

Attachment Content-Type Size
v2-0001-Fix-ADD-PRIMARY-KEY-after-dropping-and-re-adding-.patch application/octet-stream 9.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Manu 2026-09-28 17:37:32 Re: BUG #19705: One NaN box makes a BRIN box_inclusion_ops index omit unrelated rows
Previous Message Trakshan Mishra 2026-09-28 15:41:17 Re: BUG #19684: Assertion in tuplesort_begin_heap() falsified by parallel plan with sort