forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit55173d2
committed
Fix failure to create FKs correctly in partitions
On a multi-level partioned table, when adding a partition not directlyconnected to the root table, foreign key constraints referencing theroot were not cloned to the new partition, leading to the FK beingpossibly inadvertently violated later on.This was caused by fuzzy thinking in CloneFkReferenced (commitf56f8f8): it was skipping constraints marked as having parents onthe theory that cloning those would create duplicates; but that's onlycorrect for the top level of the partitioning hierarchy. For levelsbelow that one, such constraints must still be considered and onlyskipped if later on we see that we'd create duplicates. Apparently, I(Álvaro) wrote the comments right but the code implemented somethingslightly different.Author: Jehan-Guillaume de RorthaisDiscussion:https://postgr.es/m/20200206004948.238352db@firost1 parent9710d3d commit55173d2
File tree
3 files changed
+59
-11
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+59
-11
lines changedLines changed: 17 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8962 | 8962 |
| |
8963 | 8963 |
| |
8964 | 8964 |
| |
8965 |
| - | |
8966 |
| - | |
8967 |
| - | |
8968 |
| - | |
8969 |
| - | |
8970 |
| - | |
8971 |
| - | |
| 8965 | + | |
| 8966 | + | |
| 8967 | + | |
| 8968 | + | |
| 8969 | + | |
| 8970 | + | |
| 8971 | + | |
8972 | 8972 |
| |
8973 | 8973 |
| |
8974 | 8974 |
| |
| |||
8984 | 8984 |
| |
8985 | 8985 |
| |
8986 | 8986 |
| |
8987 |
| - | |
8988 |
| - | |
8989 |
| - | |
8990 |
| - | |
8991 | 8987 |
| |
8992 | 8988 |
| |
8993 | 8989 |
| |
| |||
9016 | 9012 |
| |
9017 | 9013 |
| |
9018 | 9014 |
| |
| 9015 | + | |
| 9016 | + | |
| 9017 | + | |
| 9018 | + | |
| 9019 | + | |
| 9020 | + | |
| 9021 | + | |
| 9022 | + | |
| 9023 | + | |
| 9024 | + | |
9019 | 9025 |
| |
9020 | 9026 |
| |
9021 | 9027 |
| |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2444 | 2444 |
| |
2445 | 2445 |
| |
2446 | 2446 |
| |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + |
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1722 | 1722 |
| |
1723 | 1723 |
| |
1724 | 1724 |
| |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + |
0 commit comments
Comments
(0)