forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb7cc21c
committed
pg_dump: fix dependencies on FKs to partitioned tables
Parallel-restoring a foreign key that references a partitioned tablewith several levels of partitions can fail:pg_restore: while PROCESSING TOC:pg_restore: from TOC entry 6684; 2606 29166 FK CONSTRAINT fk fk_a_fkey postgrespg_restore: error: could not execute query: ERROR: there is no unique constraint matching given keys for referenced table "pk"Command was: ALTER TABLE fkpart3.fk ADD CONSTRAINT fk_a_fkey FOREIGN KEY (a) REFERENCES fkpart3.pk(a);This happens in parallel restore mode because some index partitionsaren't yet attached to the topmost partitioned index that the FK uses,and so the index is still invalid. The current code marks the FK asdependent on the first level of index-attach dump objects; the bug isfixed by recursively marking the FK on their children.Backpatch to 12, where FKs to partitioned tables were introduced.Reported-by: Tom Lane <tgl@sss.pgh.pa.us>Author: Álvaro Herrera <alvherre@alvh.no-ip.org>Discussion:https://postgr.es/m/3170626.1594842723@sss.pgh.pa.usBackpatch: 12-master1 parent1c6066f commitb7cc21c
1 file changed
+34
-7
lines changedLines changed: 34 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
235 | 235 |
| |
236 | 236 |
| |
237 | 237 |
| |
| 238 | + | |
238 | 239 |
| |
239 | 240 |
| |
240 | 241 |
| |
| |||
7514 | 7515 |
| |
7515 | 7516 |
| |
7516 | 7517 |
| |
7517 |
| - | |
7518 | 7518 |
| |
7519 | 7519 |
| |
7520 | 7520 |
| |
7521 | 7521 |
| |
7522 | 7522 |
| |
7523 | 7523 |
| |
7524 |
| - | |
| 7524 | + | |
7525 | 7525 |
| |
7526 | 7526 |
| |
7527 | 7527 |
| |
7528 | 7528 |
| |
7529 | 7529 |
| |
7530 | 7530 |
| |
7531 |
| - | |
7532 |
| - | |
7533 |
| - | |
7534 |
| - | |
7535 |
| - | |
| 7531 | + | |
7536 | 7532 |
| |
7537 | 7533 |
| |
7538 | 7534 |
| |
| |||
7545 | 7541 |
| |
7546 | 7542 |
| |
7547 | 7543 |
| |
| 7544 | + | |
| 7545 | + | |
| 7546 | + | |
| 7547 | + | |
| 7548 | + | |
| 7549 | + | |
| 7550 | + | |
| 7551 | + | |
| 7552 | + | |
| 7553 | + | |
| 7554 | + | |
| 7555 | + | |
| 7556 | + | |
| 7557 | + | |
| 7558 | + | |
| 7559 | + | |
| 7560 | + | |
| 7561 | + | |
| 7562 | + | |
| 7563 | + | |
| 7564 | + | |
| 7565 | + | |
| 7566 | + | |
| 7567 | + | |
| 7568 | + | |
| 7569 | + | |
| 7570 | + | |
| 7571 | + | |
| 7572 | + | |
| 7573 | + | |
| 7574 | + | |
7548 | 7575 |
| |
7549 | 7576 |
| |
7550 | 7577 |
| |
|
0 commit comments
Comments
(0)