- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitbdb07d2
committed
Fix Assert failure in WITH RECURSIVE UNION queries
If the non-recursive part of a recursive CTE ended up usingTTSOpsBufferHeapTuple as the table slot type, then a duplicate valuecould cause an Assert failure in CheckOpSlotCompatibility() whenchecking the hash table for the duplicate value. The expected slot typefor the deform step was TTSOpsMinimalTuple so the Assert failed when theTTSOpsBufferHeapTuple slot was used.This is a long-standing bug which we likely didn't notice because itseems much more likely that the non-recursive term would have requiredprojection and used a TTSOpsVirtual slot, which CheckOpSlotCompatibilityis ok with.There doesn't seem to be any harm done here other than the Assertfailure. Both TTSOpsMinimalTuple and TTSOpsBufferHeapTuple slot typesrequire tuple deformation, so the EEOP_*_FETCHSOME ExprState step wouldhave properly existed in the ExprState.The solution is to pass NULL for the ExecBuildGroupingEqual's 'lops'parameter. This means the ExprState's EEOP_*_FETCHSOME step won'texpect a fixed slot type. This makes CheckOpSlotCompatibility() happy asno checking is performed when the ExprEvalStep is not expecting a fixedslot type.Reported-by: Richard GuoReviewed-by: Tom LaneDiscussion:https://postgr.es/m/CAMbWs4-8U9q2LAtf8+ghV11zeUReA3AmrYkxzBEv0vKnDxwkKA@mail.gmail.comBackpatch-through: 13, all supported versions1 parent84dc130 commitbdb07d2
File tree
3 files changed
+28
-2
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+28
-2
lines changedLines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
225 | 225 |
| |
226 | 226 |
| |
227 | 227 |
| |
228 |
| - | |
229 | 228 |
| |
230 |
| - | |
| 229 | + | |
231 | 230 |
| |
232 | 231 |
| |
233 | 232 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
636 | 636 |
| |
637 | 637 |
| |
638 | 638 |
| |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
639 | 654 |
| |
640 | 655 |
| |
641 | 656 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
347 | 347 |
| |
348 | 348 |
| |
349 | 349 |
| |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
350 | 362 |
| |
351 | 363 |
| |
352 | 364 |
| |
|
0 commit comments
Comments
(0)