forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9b21f20
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 parent1772d55 commit9b21f20
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 | |
---|---|---|---|
| |||
19987 | 19987 |
| |
19988 | 19988 |
| |
19989 | 19989 |
| |
| 19990 | + | |
19990 | 19991 |
| |
19991 | 19992 |
| |
19992 | 19993 |
| |
| |||
20007 | 20008 |
| |
20008 | 20009 |
| |
20009 | 20010 |
| |
| 20011 | + | |
| 20012 | + | |
| 20013 | + | |
| 20014 | + | |
| 20015 | + | |
| 20016 | + | |
| 20017 | + | |
| 20018 | + | |
| 20019 | + | |
| 20020 | + | |
| 20021 | + | |
| 20022 | + | |
| 20023 | + | |
| 20024 | + | |
| 20025 | + | |
| 20026 | + | |
| 20027 | + | |
20010 | 20028 |
| |
20011 | 20029 |
| |
20012 | 20030 |
| |
| |||
20020 | 20038 |
| |
20021 | 20039 |
| |
20022 | 20040 |
| |
20023 |
| - | |
| 20041 | + | |
| 20042 | + | |
| 20043 | + | |
| 20044 | + | |
20024 | 20045 |
| |
20025 |
| - | |
| 20046 | + | |
| 20047 | + | |
20026 | 20048 |
| |
20027 | 20049 |
| |
20028 | 20050 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2351 | 2351 |
| |
2352 | 2352 |
| |
2353 | 2353 |
| |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
2354 | 2361 |
| |
2355 | 2362 |
| |
2356 | 2363 |
| |
|
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)