bogus error message for ALTER TABLE ALTER CONSTRAINT

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: bogus error message for ALTER TABLE ALTER CONSTRAINT
Date: 2025-03-04 18:22:22
Message-ID: 202503041822.aobpqke3igvb@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just discovered that trying to set a foreign key as NO INHERIT in
ALTER TABLE ALTER CONSTRAINT returns an absurd error message:

create table pk (a int primary key);
create table fk (a int references pk);

alter table fk alter constraint fk_a_fkey deferrable, alter constraint fk_a_fkey no inherit;
ERROR: ALTER CONSTRAINT statement constraints cannot be marked NO INHERIT

The explanation is that somebody misunderstood what must be given to
processCASbits in 2013. The intended message is:
ERROR: FOREIGN KEY constraints cannot be marked NO INHERIT

Here's the fix along with some additional cleanup.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

Attachment Content-Type Size
0001-Fix-ALTER-TABLE-error-message.patch text/x-diff 5.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-03-04 18:36:21 Re: bogus error message for ALTER TABLE ALTER CONSTRAINT
Previous Message Heikki Linnakangas 2025-03-04 18:22:02 Rename some signal and interrupt handling functions for consistency