Another FK violation when referencing a multi-level partitionedtable
В списке pgsql-bugs по дате отправления:
| От | Jehan-Guillaume de Rorthais |
|---|---|
| Тема | Another FK violation when referencing a multi-level partitionedtable |
| Дата | |
| Msg-id | 20200206004948.238352db@firost обсуждение исходный текст |
| Ответы |
Re: Another FK violation when referencing a multi-level partitionedtable
Re: Another FK violation when referencing a multi-level partitionedtable |
| Список | pgsql-bugs |
Hello,
When working on the patch to fix another FK violation [1], I found that FK
constraints were not properly cloned to partition not directly hooked to the
root table.
CloneFkReferenced takes care to avoid inherited constraints to clone top-level
constraints only:
/*
* Search for any constraints where this partition is in the referenced
* side. However, we must ignore any constraint whose parent constraint
* is also going to be cloned, to avoid duplicates. [...]
*/
But it seems the top-level constraints are actually never cloned neither.
Surprisingly, the comment explains how this should be done in two steps, but
the code corrupted the first step by skipping inherited constraints and lacks
the second step:
* [...]to avoid duplicates. So do it in two
* steps: first construct the list of constraints to clone, then go over
* that list cloning those whose parents are not in the list. (We must
* not rely on the parent being seen first, since the catalog scan could
* return children first.)
*/
Please, find in attachment a proposal patch to fix this FK violation.
Regards,
[1] https://www.postgresql.org/message-id/20200204183906.115f693e%40firost
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера