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: | 2021-04-29 23:02:28 |
Message-ID: | 20210429230228.GA25949@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 2020-Dec-07, Tom Lane wrote:
> then everything behaves as expected. So something is broken
> about propagating deferred-ness to partition triggers in an
> ALTER CONSTRAINT. Oddly, it *looks* like it worked if you
> examine the child tables with "\d+". I surmise that ALTER CONSTRAINT
> fixes whatever catalog fields psql looks at, but there's some other
> fields that also need to be updated and aren't being.
I came up with this. As I mentioned in my earlier reply, handling
recursion in the usual way doesn't fix the whole problem, because we
need to recurse on possibly both sides of the constraint. So I made it
recurse using pg_constraint.conparentid, which seems easier and cover
both ends. This is pretty crude so far but it handles the trivial
cases. What I did is split the existing routine in two, and the "inner"
part now recurses on itself if it sees that either table is partitioned.
I'll polish it tomorrow -- intend to get this pushed to branches back to
11, depending on what's needed.
--
Álvaro Herrera Valdivia, Chile
Attachment | Content-Type | Size |
---|---|---|
constraints.patch | text/x-diff | 13.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2021-04-30 01:00:04 | Re: BUG #16939: Plural interval for negative singular |
Previous Message | Tom Lane | 2021-04-29 16:05:32 | Re: BUG #16976: server crash when deleting via a trigger on a foreign table |