forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8f2ec8c
committed
Don't use partial unique indexes for unique proofs in the planner
Here we adjust relation_has_unique_index_for() so that it no longer makesuse of partial unique indexes as uniqueness proofs. It is incorrect touse these as the predicates used by check_index_predicates() to setpredOK makes use of not only baserestrictinfo quals as proofs, but alsoqual from join conditions. For relation_has_unique_index_for()'s case, weneed to know the relation is unique for a given set of columns before anyjoins are evaluated, so if predOK was only set to true due to some joinqual, then it's unsafe to use such indexes inrelation_has_unique_index_for(). The final plan may not even make useof that index, which could result in reading tuples that are not asunique as the planner previously expected them to be.Bug: #17975Reported-by: Tor Erik LinnerudBackpatch-through: 11, all supported versionsDiscussion:https://postgr.es/m/17975-98a90c156f25c952%40postgresql.org1 parent3547035 commit8f2ec8c
File tree
4 files changed
+36
-8
lines changed- src
- backend/optimizer
- path
- plan
- test/regress
- expected
- sql
4 files changed
+36
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3557 | 3557 | | |
3558 | 3558 | | |
3559 | 3559 | | |
3560 | | - | |
| 3560 | + | |
| 3561 | + | |
| 3562 | + | |
| 3563 | + | |
| 3564 | + | |
3561 | 3565 | | |
3562 | | - | |
3563 | | - | |
| 3566 | + | |
3564 | 3567 | | |
3565 | 3568 | | |
3566 | 3569 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
603 | | - | |
604 | | - | |
605 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
614 | | - | |
| 613 | + | |
615 | 614 | | |
616 | 615 | | |
617 | 616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6503 | 6503 | | |
6504 | 6504 | | |
6505 | 6505 | | |
| 6506 | + | |
| 6507 | + | |
| 6508 | + | |
| 6509 | + | |
| 6510 | + | |
| 6511 | + | |
| 6512 | + | |
| 6513 | + | |
| 6514 | + | |
| 6515 | + | |
| 6516 | + | |
| 6517 | + | |
| 6518 | + | |
| 6519 | + | |
| 6520 | + | |
| 6521 | + | |
| 6522 | + | |
6506 | 6523 | | |
6507 | 6524 | | |
6508 | 6525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2263 | 2263 | | |
2264 | 2264 | | |
2265 | 2265 | | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
2266 | 2275 | | |
2267 | 2276 | | |
2268 | 2277 | | |
| |||
0 commit comments
Comments
(0)