- Notifications
You must be signed in to change notification settings - Fork5
Commit80f66a9
committed
Fix planner failure with full join in RHS of left join.
Given a left join containing a full join in its righthand side, withthe left join's joinclause referencing only one side of the full join(in a non-strict fashion, so that the full join doesn't get simplified),the planner could fail with "failed to build any N-way joins" or relatederrors. This happened because the full join was seen as overlapping theleft join's RHS, and then recent changes within join_is_legal() causedthat function to conclude that the full join couldn't validly be formed.Rather than try to rejigger join_is_legal() yet more to allow this,I think it's better to fix initsplan.c so that the required join orderis explicit in the SpecialJoinInfo data structure. The previous codingthere essentially ignored full joins, relying on the fact that we don'tflatten them in the joinlist data structure to preserve their ordering.That's sufficient to prevent a wrong plan from being formed, but as thisexample shows, it's not sufficient to ensure that the right plan willbe formed. We need to work a bit harder to ensure that the right planlooks sane according to the SpecialJoinInfos.Per bug #14105 from Vojtech Rylko. This was apparently induced bycommit8703059 (though now that I've seen it, I wonder whether thereare related cases that could have failed before that); so back-patchto all active branches. Unfortunately, that patch also went into 9.0,so this bug is a regression that won't be fixed in that branch.1 parent125ad53 commit80f66a9
File tree
3 files changed
+72
-1
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
3 files changed
+72
-1
lines changedLines changed: 24 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1176 | 1176 |
| |
1177 | 1177 |
| |
1178 | 1178 |
| |
1179 |
| - | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
1180 | 1184 |
| |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
1181 | 1203 |
| |
| 1204 | + | |
1182 | 1205 |
| |
1183 | 1206 |
| |
1184 | 1207 |
| |
|
Lines changed: 31 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3801 | 3801 |
| |
3802 | 3802 |
| |
3803 | 3803 |
| |
| 3804 | + | |
| 3805 | + | |
| 3806 | + | |
| 3807 | + | |
| 3808 | + | |
| 3809 | + | |
| 3810 | + | |
| 3811 | + | |
| 3812 | + | |
| 3813 | + | |
| 3814 | + | |
| 3815 | + | |
| 3816 | + | |
| 3817 | + | |
| 3818 | + | |
| 3819 | + | |
| 3820 | + | |
| 3821 | + | |
| 3822 | + | |
| 3823 | + | |
| 3824 | + | |
| 3825 | + | |
| 3826 | + | |
| 3827 | + | |
| 3828 | + | |
| 3829 | + | |
| 3830 | + | |
| 3831 | + | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
3804 | 3835 |
| |
3805 | 3836 |
| |
3806 | 3837 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1209 | 1209 |
| |
1210 | 1210 |
| |
1211 | 1211 |
| |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1212 | 1229 |
| |
1213 | 1230 |
| |
1214 | 1231 |
| |
|
0 commit comments
Comments
(0)