Re: BUG #15425: DETACH/ATTACH PARTITION bug

Поиск
Список
Период
Сортировка
Искать
От
Alvaro Herrera
Тема
Re: BUG #15425: DETACH/ATTACH PARTITION bug
Дата
Msg-id
20181011220902.lx5xr4jl5nxl6ved@alvherre.pgsql
Ответ на
Список
Дерево обсуждения
BUG #15425: DETACH/ATTACH PARTITION bug PG Bug reporting form <noreply@postgresql.org>
Re: BUG #15425: DETACH/ATTACH PARTITION bug Alvaro Herrera <alvherre@2ndquadrant.com>
Re: BUG #15425: DETACH/ATTACH PARTITION bug Alvaro Herrera <alvherre@2ndquadrant.com>
Re: BUG #15425: DETACH/ATTACH PARTITION bug Alvaro Herrera <alvherre@2ndquadrant.com>
Re: BUG #15425: DETACH/ATTACH PARTITION bug Alvaro Herrera <alvherre@2ndquadrant.com>
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
В списке pgsql-bugs по дате отправления
От: Abhishek Tripathi
Дата:
От: PG Bug reporting form
Дата:
FAQ