drop column name conflict

From: Joseph Koshakow <koshy44(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: drop column name conflict
Date: 2024-05-04 14:37:34
Message-ID: CAAvxfHcB8zPLiTLYc=GqQCM157aRNp7nMD567KCG-dEqVNdAMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

There's a rare edge case in `alter table` that can prevent users from
dropping a column as shown below

# create table atacc1(a int, "........pg.dropped.1........" int);
CREATE TABLE
# alter table atacc1 drop column a;
ERROR: duplicate key value violates unique constraint
"pg_attribute_relid_attnam_index"
DETAIL: Key (attrelid, attname)=(16407, ........pg.dropped.1........)
already exists.

It seems a bit silly and unlikely that anyone would ever find
themselves in this scenario, but it also seems easy enough to fix as
shown by the attached patch.

Does anyone think this is worth fixing? If so I can submit it to the
current commitfest.

Thanks,
Joe Koshakow

Attachment Content-Type Size
v1-0001-Prevent-name-conflicts-when-dropping-a-column.patch text/x-patch 3.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-05-04 15:29:30 Re: drop column name conflict
Previous Message David Rowley 2024-05-04 13:16:19 Re: On disable_cost