Don't call ExecAssignScanProjectionInfo while in partitionMemoryContext.
This allows removing the weird pfree() of the resultTupleSlot's tuple descriptor. What would've happened without the pfree() is that the old slot was allocated in the first ExecAssignScanProjectionInfo() call, in partitionMemoryContext, and then immediately destroyed when the memory context was reset. The second call to ExecAssignScanProjectionInfo() tries to free the slot, again, causing the segfault. But we can avoid that by this rearrangement of the calls in a cleaner way. In the passing, clean up the code a bit. I found having separate variables, indexState and scanState, which point to the same struct, to be confusing.
Showing
想要评论请 注册 或 登录