forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7a980df
committed
Fix matching of sub-partitions when a partitioned plan is stale.
Since we no longer require AccessExclusiveLock to add a partition,the executor may see that a partitioned table has more partitionsthan the planner saw. ExecCreatePartitionPruneState's code formatching up the partition lists in such cases was faulty, and wouldmisbehave if the planner had successfully pruned any partitions fromthe query. (Thus, trouble would occur only if a partition additionhappens concurrently with a query that uses both static and dynamicpartition pruning.) This led to an Assert failure in debug builds,and probably to crashes or query misbehavior in production builds.To repair the bug, just explicitly skip zeroes in the plan'srelid_map[] list. I also made some cosmetic changes to make the codemore readable (IMO anyway). Also, convert the cross-checking Assertto a regular test-and-elog, since it's now apparent that this logicis more fragile than one would like.Currently, there's no way to repeatably exercise this code, exceptwith manual use of a debugger to stop the backend between planningand execution. Hence, no test case in this patch. We oughta dosomething about that testability gap, but that's for another day.Amit Langote and Tom Lane, per report from Justin Pryzby. Oversightin commit898e5e3; backpatch to v12 where that appeared.Discussion:https://postgr.es/m/20200802181131.GA27754@telsasoft.com1 parentf47b5e1 commit7a980df
1 file changed
+36
-11
lines changedLines changed: 36 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1667 | 1667 |
| |
1668 | 1668 |
| |
1669 | 1669 |
| |
1670 |
| - | |
1671 |
| - | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
1672 | 1679 |
| |
1673 | 1680 |
| |
1674 |
| - | |
| 1681 | + | |
1675 | 1682 |
| |
1676 |
| - | |
1677 |
| - | |
1678 |
| - | |
1679 |
| - | |
1680 |
| - | |
1681 |
| - | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
1682 | 1690 |
| |
| 1691 | + | |
1683 | 1692 |
| |
1684 | 1693 |
| |
1685 | 1694 |
| |
1686 |
| - | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
1687 | 1703 |
| |
1688 | 1704 |
| |
1689 |
| - | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
1690 | 1715 |
| |
1691 | 1716 |
| |
1692 | 1717 |
| |
|
0 commit comments
Comments
(0)