Re: ALTER CONSTRAINT on a partitioned FK isn't working

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: ALTER CONSTRAINT on a partitioned FK isn't working
Date: 2020-12-07 23:52:06
Message-ID: 20201207235206.GA2277@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2020-Dec-07, Alvaro Herrera wrote:

> Yeah, this query shows that the tgdeferrable and tginitdeferred columns
> ought to be dropped:
>
> select tgname, tgdeferrable, tginitdeferred from pg_trigger;

Sorry, I meant "ought to be updated". But there's more to it than that:
the pg_constraint entries themselves are not updated, and that's because
ALTER CONSTRAINT does not have recurse at all. So the first thing to do
is add an "ATSimpleRecursion()" call for the appropriate case, but even
that is not sufficient, as we need to recurse on the referenced side
also, not just the referencing side -- and that's a tad more involved.
(ATExecAlterConstraint is explicitly not handling the case.)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2020-12-08 07:35:29 Re: BUG #16754: When using LLVM and parallel queries aborted all session by pg_cancel_backend.
Previous Message Alvaro Herrera 2020-12-07 23:34:14 Re: ALTER CONSTRAINT on a partitioned FK isn't working