From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | mikemjv(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: BUG #15425: DETACH/ATTACH PARTITION bug |
Date: | 2018-10-11 22:09:02 |
Message-ID: | 20181011220902.lx5xr4jl5nxl6ved@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Another version. I realized that attaching a partitioned partition had
further trouble, because the recursion at each step would consider all
FKs instead of only the FKs that had been cloned. So I had to split out
the recursive step of the cloning. Now that works fine.
In order to make this work, I made two little change to struct
ForeignKeyCacheInfo: first, the constraint OID was added. Second, I
made RelationGetFKeyList() return a nonempty list for partitioned
tables, which it didn't before (because of the optimization that
presupposes no triggers means no FKs, which is not true for partitioned
tables). As far as I can see, this has no effect on how the planner
uses this function. (This stuff could be done with repeated scans of
pg_constraint, but it seems much simpler this way.)
Michael sent me his test case offlist, and I verified that it works
correctly with this patch.
Unless there are objections, I intend to get this pushed tomorrow.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
detach-fks.patch | text/x-diff | 25.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2018-10-12 03:27:28 | BUG #15427: DROP INDEX did not free up disk space |
Previous Message | Alban Hertroys | 2018-10-11 14:56:38 | Re: Want to acquire lock on tables where primary of one table is foreign key on othere |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2018-10-11 22:48:38 | Re: Code of Conduct plan |
Previous Message | Andres Freund | 2018-10-11 21:53:10 | Re: [HACKERS] removing abstime, reltime, tinterval.c, spi/timetravel |