]> granicus.if.org Git - postgresql/commit
Fix cross-type case in partial row matching for hashed subplans.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Oct 2012 16:21:29 +0000 (12:21 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Oct 2012 16:21:29 +0000 (12:21 -0400)
commit47232d7347791a1f9220a1daf3ccd2953f23bd08
tree2c189d7de29a8c24c42477620c900907fd637c89
parent3aa082f37aca0b14ffdd90167e236c228d73b586
Fix cross-type case in partial row matching for hashed subplans.

When hashing a subplan like "WHERE (a, b) NOT IN (SELECT x, y FROM ...)",
findPartialMatch() attempted to match rows using the hashtable's internal
equality operators, which of course are for x and y's datatypes.  What we
need to use are the potentially cross-type operators for a=x, b=y, etc.
Failure to do that leads to wrong answers or even crashes.  The scope for
problems is limited to cases where we have different types with compatible
hash functions (else we'd not be using a hashed subplan), but for example
int4 vs int8 can cause the problem.

Per bug #7597 from Bo Jensen.  This has been wrong since the hashed-subplan
code was written, so patch all the way back.
src/backend/executor/nodeSubplan.c
src/test/regress/expected/subselect.out
src/test/regress/sql/subselect.sql