forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf00ab1f

Richard Guo
Fix inconsistent RestrictInfo serial numbers
When we generate multiple clones of the same qual condition to copewith outer join identity 3, we need to ensure that all the clones getthe same serial number. To achieve this, we reset theroot->last_rinfo_serial counter each time we produce RestrictInfo(s)from the qual list (see deconstruct_distribute_oj_quals). Thisapproach works only if we ensure that we are not changing the quallist in any way that'd affect the number of RestrictInfos built fromit.However, withb262ad4, an IS NULL qual on a NOT NULL column mightresult in an additional constant-FALSE RestrictInfo. And differentversions of the same qual clause can lead to different conclusionsabout whether it can be reduced to constant-FALSE. This would affectthe number of RestrictInfos built from the qual list for differentversions, causing inconsistent RestrictInfo serial numbers acrossmultiple clones of the same qual. This inconsistency can confuseusers of these serial numbers, such as rebuild_joinclause_attr_needed,and lead to planner errors such as "ERROR: variable not found insubplan target lists".To fix, reset the root->last_rinfo_serial counter after generating theadditional constant-FALSE RestrictInfo.Back-patch to v17 where the issue crept in. In v17, I failed to makea test case that would expose this bug, so no test case for v17.Author: Richard GuoDiscussion:https://postgr.es/m/CAMbWs4-B6kafn+LmPuh-TYFwFyEm-vVj3Qqv7Yo-69CEv14rRg@mail.gmail.com1 parent41b98dd commitf00ab1f
File tree
4 files changed
+62
-3
lines changed- src
- backend/optimizer
- plan
- util
- test/regress
- expected
- sql
4 files changed
+62
-3
lines changedLines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2767 | 2767 |
| |
2768 | 2768 |
| |
2769 | 2769 |
| |
2770 |
| - | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
2771 | 2777 |
| |
2772 | 2778 |
| |
2773 | 2779 |
| |
2774 | 2780 |
| |
| 2781 | + | |
2775 | 2782 |
| |
2776 | 2783 |
| |
2777 | 2784 |
| |
| |||
2784 | 2791 |
| |
2785 | 2792 |
| |
2786 | 2793 |
| |
| 2794 | + | |
2787 | 2795 |
| |
2788 | 2796 |
| |
2789 | 2797 |
| |
|
Lines changed: 10 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
106 | 106 |
| |
107 | 107 |
| |
108 | 108 |
| |
109 |
| - | |
110 |
| - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
111 | 117 |
| |
112 | 118 |
| |
113 | 119 |
| |
114 | 120 |
| |
| 121 | + | |
115 | 122 |
| |
116 | 123 |
| |
117 | 124 |
| |
| |||
124 | 131 |
| |
125 | 132 |
| |
126 | 133 |
| |
| 134 | + | |
127 | 135 |
| |
128 | 136 |
| |
129 | 137 |
| |
|
Lines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
290 | 290 |
| |
291 | 291 |
| |
292 | 292 |
| |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + |
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
147 | 147 |
| |
148 | 148 |
| |
149 | 149 |
| |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + |
0 commit comments
Comments
(0)