Skip site navigation (1) Skip section navigation (2)

pgsql: Fix cross-type case in partial row matching for hashedsubplans.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix cross-type case in partial row matching for hashedsubplans.
Date: 2012-10-11 16:22:35
Message-ID: E1TMLWt-0005Cb-SH@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
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.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/5c07de4bdfadd2ea73c66dcad3b0e4d5ca4ceef7

Modified Files
--------------
src/backend/executor/nodeSubplan.c      |   17 +++++++++++------
src/test/regress/expected/subselect.out |   17 +++++++++++++++++
src/test/regress/sql/subselect.sql      |   15 +++++++++++++++
3 files changed, 43 insertions(+), 6 deletions(-)

pgsql-committers by date

Next:From: Andrew DunstanDate: 2012-10-11 16:41:43
Subject: pgsql: Unbreak MSVC builds after recent Makefile refactoring.
Previous:From: Heikki LinnakangasDate: 2012-10-11 14:52:17
Subject: pgsql: Improve replication connection timeouts.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group