Dean Rasheed <[email protected]> 于2026年11月22日周日 19:32写道: > > Hmm, I don't like that solution because it's somewhat delocalised, > which I think makes it fragile if new code is added using > context->planSlot, instead of your new returningSlot. > > I think a better (more localised) solution is to have > ExecMergeMatched() swap out context->planSlot while it executes the > NOT MATCHED BY SOURCE action. That feels more robust, because it > removes any chance of any code called while executing the action > seeing the old stale source values. Something like v2, attached. >
Yeah, I agree that temporarily replacing context->planSlot in ExecMergeMatched() is cleaner. It gives the entire NOT MATCHED BY SOURCE action a consistent view of the source row, including the cross-partition RETURNING path. Restoring the original slot before returning also makes it available to any subsequent NOT MATCHED BY TARGET action. > Also, I don't think merge-match-recheck is the right place to test > this, since it's not about rechecking AND conditions. I've added new > tests to merge-not-matched, based on the ones added before for bug > #19912, testing both left and full joins. > +1 -- Tender Wang
