From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: bogus error message for ALTER TABLE ALTER CONSTRAINT |
Date: | 2025-03-04 21:50:28 |
Message-ID: | 195582.1741125028@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> 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
Hmm. I agree that "ALTER CONSTRAINT statement" is off the
mark here, but I'm not convinced that "FOREIGN KEY" is entirely
on-point either. The grammar has no way of knowing what kind of
constraint is being targeted. I do see that ATExecAlterConstraint
currently rejects every other kind of constraint, but do we need
to think of a more generic phrase?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2025-03-04 21:56:22 | Re: Add contrib/pg_logicalsnapinspect |
Previous Message | Andres Freund | 2025-03-04 21:46:51 | Re: scalability bottlenecks with (many) partitions (and more) |