- Notifications
You must be signed in to change notification settings - Fork5
Commit462bd95
committed
Fix planning of SELECT FOR UPDATE on child table with partial index.
Ordinarily we can omit checking of a WHERE condition that matches a partialindex's condition, when we are using an indexscan on that partial index.However, in SELECT FOR UPDATE we must include the "redundant" filtercondition in the plan so that it gets checked properly in an EvalPlanQualrecheck. The planner got this mostly right, but improperly omitted thefilter condition if the index in question was on an inheritance childtable. In READ COMMITTED mode, this could result in incorrectly returningjust-updated rows that no longer satisfy the filter condition.The cause of the error is using get_parse_rowmark() when get_plan_rowmark()is what should be used during planning. In 9.3 and up, also fix the samemistake in contrib/postgres_fdw. It's currently harmless there (for lackof inheritance support) but wrong is wrong, and the incorrect code mightget copied to someplace where it's more significant.Report and fix by Kyotaro Horiguchi. Back-patch to all supported branches.1 parent2db576b commit462bd95
File tree
2 files changed
+12
-8
lines changed- contrib/postgres_fdw
- src/backend/optimizer/plan
2 files changed
+12
-8
lines changedLines changed: 10 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
822 | 822 |
| |
823 | 823 |
| |
824 | 824 |
| |
825 |
| - | |
| 825 | + | |
826 | 826 |
| |
827 | 827 |
| |
828 | 828 |
| |
| |||
835 | 835 |
| |
836 | 836 |
| |
837 | 837 |
| |
838 |
| - | |
| 838 | + | |
839 | 839 |
| |
840 |
| - | |
841 |
| - | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
842 | 846 |
| |
843 | 847 |
| |
844 |
| - | |
845 |
| - | |
846 |
| - | |
| 848 | + | |
| 849 | + | |
847 | 850 |
| |
848 | 851 |
| |
849 | 852 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| 37 | + | |
37 | 38 |
| |
38 | 39 |
| |
39 | 40 |
| |
| |||
1231 | 1232 |
| |
1232 | 1233 |
| |
1233 | 1234 |
| |
1234 |
| - | |
| 1235 | + | |
1235 | 1236 |
| |
1236 | 1237 |
| |
1237 | 1238 |
| |
|
0 commit comments
Comments
(0)