Re: BUG #17985: Inconsistent results of SELECT comparing two CASE WHEN clause
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: zuming.jiang@inf.ethz.ch
Cc: pgsql-bugs@lists.postgresql.org
Date: 2023-06-20T20:59:50Z
Lists: pgsql-bugs
Attachments
- better-fix-for-bug-17985.patch (text/x-diff) patch
I wrote: > One way to fix it is as attached. I wonder though if this isn't > telling us that there's a bug in the planner's assignment of > allParams bits for Hash nodes. The dangerous Param is present > in the Hash node's hashkeys field, so why isn't the existing > chgParam test adequate? Yeah, so looking at that, the planner is just ignoring Hash.hashkeys, apparently figuring that incorporating Param IDs from HashJoin.hashclauses into the allParams for the parent HashJoin is sufficient. But as we see here, it isn't. The attached seems like a better fix. regards, tom lane
Commits
-
Fix hash join when inner hashkey expressions contain Params.
- c2f974fffbec 15.4 landed
- 45392626c95c 16.0 landed
- d911dce14d76 14.9 landed
- 9529b1eb1b83 12.16 landed
- 2f97105e93c2 13.12 landed
-
Don't include outer join relids in lateral_relids bitmapsets.
- efeb12ef0bfe 16.0 cited
-
Small performance improvement for hash joins and hash aggregation:
- d24d75ff194e 7.4.1 cited