forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcfde234
committed
Fix RANGE partition pruning with multiple boolean partition keys
match_clause_to_partition_key incorrectly would returnPARTCLAUSE_UNSUPPORTED if a bool qual could not be matched to the currentpartition key. This was a problem, as it causes the calling function todiscard the qual and not try to match it to any other partition key. Ifthere was another partition key which did match this qual, then the qualwould not be checked again and we could fail to prune some partitions.The worst this could do was to cause partitions not to be pruned when theycould have been, so there was no danger of incorrect query results here.Fix this by changing match_boolean_partition_clause to have it return aPartClauseMatchStatus rather than a boolean value. This allows it tocommunicate if the qual is unsupported or if it just does not match thisparticular partition key, previously these two cases were treated thesame. Now, if match_clause_to_partition_key is unable to match the qualto any other qual type then we can simply return the value from thematch_boolean_partition_clause call so that the calling function properlytreats the qual as either unmatched or unsupported.Reported-by: Rares SalcudeanReviewed-by: Amit LangoteBackpatch-through: 11 where partition pruning was introducedDiscussion:https://postgr.es/m/CAHp_FN2xwEznH6oyS0hNTuUUZKp5PvegcVv=Co6nBXJ+mC7Y5w@mail.gmail.com1 parent0cea6eb commitcfde234
File tree
3 files changed
+61
-15
lines changed- src
- backend/partitioning
- test/regress
- expected
- sql
3 files changed
+61
-15
lines changedLines changed: 37 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
197 |
| - | |
198 |
| - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
199 | 201 |
| |
200 | 202 |
| |
201 | 203 |
| |
| |||
1623 | 1625 |
| |
1624 | 1626 |
| |
1625 | 1627 |
| |
| 1628 | + | |
1626 | 1629 |
| |
1627 | 1630 |
| |
1628 | 1631 |
| |
| |||
1631 | 1634 |
| |
1632 | 1635 |
| |
1633 | 1636 |
| |
1634 |
| - | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
1635 | 1641 |
| |
1636 | 1642 |
| |
1637 | 1643 |
| |
| |||
2147 | 2153 |
| |
2148 | 2154 |
| |
2149 | 2155 |
| |
2150 |
| - | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
2151 | 2171 |
| |
2152 | 2172 |
| |
2153 | 2173 |
| |
| |||
3395 | 3415 |
| |
3396 | 3416 |
| |
3397 | 3417 |
| |
3398 |
| - | |
3399 |
| - | |
3400 |
| - | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
3401 | 3425 |
| |
3402 |
| - | |
| 3426 | + | |
3403 | 3427 |
| |
3404 | 3428 |
| |
3405 | 3429 |
| |
| |||
3408 | 3432 |
| |
3409 | 3433 |
| |
3410 | 3434 |
| |
3411 |
| - | |
| 3435 | + | |
3412 | 3436 |
| |
3413 | 3437 |
| |
3414 | 3438 |
| |
| |||
3417 | 3441 |
| |
3418 | 3442 |
| |
3419 | 3443 |
| |
3420 |
| - | |
| 3444 | + | |
3421 | 3445 |
| |
3422 | 3446 |
| |
3423 | 3447 |
| |
| |||
3430 | 3454 |
| |
3431 | 3455 |
| |
3432 | 3456 |
| |
3433 |
| - | |
| 3457 | + | |
3434 | 3458 |
| |
3435 | 3459 |
| |
3436 | 3460 |
| |
| |||
3450 | 3474 |
| |
3451 | 3475 |
| |
3452 | 3476 |
| |
3453 |
| - | |
| 3477 | + | |
3454 | 3478 |
| |
3455 | 3479 |
| |
3456 |
| - | |
| 3480 | + | |
3457 | 3481 |
| |
3458 | 3482 |
| |
3459 | 3483 |
| |
|
Lines changed: 14 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1086 | 1086 |
| |
1087 | 1087 |
| |
1088 | 1088 |
| |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1089 | 1102 |
| |
1090 | 1103 |
| |
1091 | 1104 |
| |
| |||
1420 | 1433 |
| |
1421 | 1434 |
| |
1422 | 1435 |
| |
1423 |
| - | |
| 1436 | + | |
1424 | 1437 |
| |
1425 | 1438 |
| |
1426 | 1439 |
| |
|
Lines changed: 10 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
162 | 171 |
| |
163 | 172 |
| |
164 | 173 |
| |
| |||
264 | 273 |
| |
265 | 274 |
| |
266 | 275 |
| |
267 |
| - | |
| 276 | + | |
268 | 277 |
| |
269 | 278 |
| |
270 | 279 |
| |
|
0 commit comments
Comments
(0)