Commit 2d5fe51
committed
Fix some more bugs in foreign keys connecting partitioned tables
* In DetachPartitionFinalize() we were applying a tuple conversion map
to tuples that didn't need one, which can lead to erratic behavior if
a partitioned table has a partition with a different column order, as
reported by Alexander Lakhin. This was introduced by 53af949.
Don't do that. Also, modify a recently added test case to exercise
this.
* The same function as well as CloneFkReferenced() were acquiring
AccessShareLock on a partition, only to have CreateTrigger() later
acquire ShareRowExclusiveLock on it. This can lead to deadlock by
lock escalation, unnecessarily. Avoid that by acquiring the stronger
lock to begin with. This probably dates back to branch 12, but I have
never seen a report of this being a problem in the field.
* Innocuous but wasteful: also introduced by 53af949, we were
reading a pg_constraint tuple from syscache that we don't need, as
reported by Tender Wang. Don't.
Backpatch to 15.
Discussion: https://postgr.es/m/461e9c26-2076-8224-e119-84998b6a784e@gmail.com1 parent 2845cd1 commit 2d5fe51
File tree
3 files changed
+27
-30
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+27
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10372 | 10372 | | |
10373 | 10373 | | |
10374 | 10374 | | |
| 10375 | + | |
| 10376 | + | |
| 10377 | + | |
10375 | 10378 | | |
10376 | 10379 | | |
10377 | 10380 | | |
| |||
10398 | 10401 | | |
10399 | 10402 | | |
10400 | 10403 | | |
| 10404 | + | |
10401 | 10405 | | |
10402 | 10406 | | |
10403 | 10407 | | |
| |||
10503 | 10507 | | |
10504 | 10508 | | |
10505 | 10509 | | |
| 10510 | + | |
| 10511 | + | |
10506 | 10512 | | |
10507 | 10513 | | |
10508 | 10514 | | |
| |||
10796 | 10802 | | |
10797 | 10803 | | |
10798 | 10804 | | |
10799 | | - | |
10800 | | - | |
10801 | | - | |
10802 | | - | |
10803 | | - | |
10804 | | - | |
10805 | | - | |
| 10805 | + | |
| 10806 | + | |
10806 | 10807 | | |
10807 | 10808 | | |
10808 | 10809 | | |
| |||
19436 | 19437 | | |
19437 | 19438 | | |
19438 | 19439 | | |
19439 | | - | |
19440 | | - | |
| 19440 | + | |
19441 | 19441 | | |
19442 | 19442 | | |
19443 | 19443 | | |
| |||
19455 | 19455 | | |
19456 | 19456 | | |
19457 | 19457 | | |
19458 | | - | |
19459 | | - | |
19460 | | - | |
19461 | | - | |
19462 | | - | |
19463 | | - | |
19464 | | - | |
19465 | 19458 | | |
19466 | 19459 | | |
19467 | 19460 | | |
| |||
19502 | 19495 | | |
19503 | 19496 | | |
19504 | 19497 | | |
19505 | | - | |
19506 | 19498 | | |
19507 | 19499 | | |
19508 | 19500 | | |
| |||
19535 | 19527 | | |
19536 | 19528 | | |
19537 | 19529 | | |
19538 | | - | |
19539 | | - | |
19540 | | - | |
| 19530 | + | |
19541 | 19531 | | |
19542 | 19532 | | |
19543 | 19533 | | |
19544 | 19534 | | |
19545 | 19535 | | |
19546 | | - | |
| 19536 | + | |
| 19537 | + | |
19547 | 19538 | | |
19548 | 19539 | | |
19549 | 19540 | | |
19550 | 19541 | | |
19551 | | - | |
| 19542 | + | |
19552 | 19543 | | |
19553 | 19544 | | |
19554 | 19545 | | |
| |||
19565 | 19556 | | |
19566 | 19557 | | |
19567 | 19558 | | |
19568 | | - | |
| 19559 | + | |
19569 | 19560 | | |
19570 | 19561 | | |
19571 | 19562 | | |
19572 | | - | |
19573 | 19563 | | |
19574 | 19564 | | |
19575 | 19565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2944 | 2944 | | |
2945 | 2945 | | |
2946 | 2946 | | |
2947 | | - | |
| 2947 | + | |
2948 | 2948 | | |
2949 | 2949 | | |
2950 | 2950 | | |
2951 | | - | |
| 2951 | + | |
2952 | 2952 | | |
2953 | 2953 | | |
2954 | 2954 | | |
2955 | 2955 | | |
2956 | 2956 | | |
2957 | 2957 | | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
2958 | 2961 | | |
2959 | 2962 | | |
2960 | 2963 | | |
| |||
2993 | 2996 | | |
2994 | 2997 | | |
2995 | 2998 | | |
2996 | | - | |
| 2999 | + | |
2997 | 3000 | | |
2998 | 3001 | | |
2999 | 3002 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2097 | 2097 | | |
2098 | 2098 | | |
2099 | 2099 | | |
2100 | | - | |
| 2100 | + | |
2101 | 2101 | | |
2102 | 2102 | | |
2103 | 2103 | | |
2104 | | - | |
| 2104 | + | |
2105 | 2105 | | |
2106 | 2106 | | |
2107 | 2107 | | |
2108 | 2108 | | |
2109 | 2109 | | |
2110 | 2110 | | |
2111 | 2111 | | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
2112 | 2116 | | |
2113 | 2117 | | |
2114 | 2118 | | |
| |||
2124 | 2128 | | |
2125 | 2129 | | |
2126 | 2130 | | |
2127 | | - | |
| 2131 | + | |
2128 | 2132 | | |
2129 | 2133 | | |
2130 | 2134 | | |
| |||
0 commit comments