forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2f30847
committed
Fix detach of a partition that has a toplevel FK to a partitioned table
In common cases, foreign keys are defined on the toplevel partitionedtable; but if instead one is defined on a partition and references apartitioned table, and the referencing partition is detached, we wouldexamine the pg_constraint row on the partition being detached, and failto realize that the sub-constraints must be left alone. This causes theALTER TABLE DETACH process to fail with ERROR: could not find ON INSERT check triggers of foreign key constraint NNNThis is similar but not quite the same as what was fixed by53af949. This bug doesn't affect branches earlier than 15, becausethe detach procedure was different there, so we only backpatch down to15.Fix by skipping such modifying constraints that are children of otherconstraints being detached.Author: Amul Sul <sulamul@gmail.com>Diagnosys-by: Sami Imseih <samimseih@gmail.com>Discussion:https://postgr.es/m/CAAJ_b97GuPh6wQPbxQS-Zpy16Oh+0aMv-w64QcGrLhCOZZ6p+g@mail.gmail.com1 parente292ba3 commit2f30847
File tree
3 files changed
+39
-2
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+39
-2
lines changedLines changed: 24 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19258 | 19258 |
| |
19259 | 19259 |
| |
19260 | 19260 |
| |
| 19261 | + | |
19261 | 19262 |
| |
19262 | 19263 |
| |
19263 | 19264 |
| |
| |||
19278 | 19279 |
| |
19279 | 19280 |
| |
19280 | 19281 |
| |
| 19282 | + | |
| 19283 | + | |
| 19284 | + | |
| 19285 | + | |
| 19286 | + | |
| 19287 | + | |
| 19288 | + | |
| 19289 | + | |
| 19290 | + | |
| 19291 | + | |
| 19292 | + | |
| 19293 | + | |
| 19294 | + | |
| 19295 | + | |
| 19296 | + | |
| 19297 | + | |
| 19298 | + | |
19281 | 19299 |
| |
19282 | 19300 |
| |
19283 | 19301 |
| |
| |||
19291 | 19309 |
| |
19292 | 19310 |
| |
19293 | 19311 |
| |
19294 |
| - | |
| 19312 | + | |
| 19313 | + | |
| 19314 | + | |
| 19315 | + | |
19295 | 19316 |
| |
19296 |
| - | |
| 19317 | + | |
| 19318 | + | |
19297 | 19319 |
| |
19298 | 19320 |
| |
19299 | 19321 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2339 | 2339 |
| |
2340 | 2340 |
| |
2341 | 2341 |
| |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
2342 | 2349 |
| |
2343 | 2350 |
| |
2344 | 2351 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1672 | 1672 |
| |
1673 | 1673 |
| |
1674 | 1674 |
| |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
1675 | 1683 |
| |
1676 | 1684 |
| |
1677 | 1685 |
| |
|
0 commit comments
Comments
(0)