]> granicus.if.org Git - postgresql/commit
Fix bug introduced into mergejoin logic by performance improvement patch of
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 17 Mar 2006 19:38:21 +0000 (19:38 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 17 Mar 2006 19:38:21 +0000 (19:38 +0000)
commit8bf221b09b09d9e84bc63749e14e6701164a2e4b
treefd1dfd477ecc9d5d08975b8ef3a91e308299330c
parentd777a571336aff734a4f00cbcb7b9bd268dd23d7
Fix bug introduced into mergejoin logic by performance improvement patch of
2005-05-13.  When we find that a new inner tuple can't possibly match any
outer tuple (because it contains a NULL), we can't immediately skip the
tuple when we are in NEXTINNER state.  Doing so can lead to emitting
multiple copies of the tuple in FillInner mode, because we may rescan the
tuple after returning to a previous marked tuple.  Instead, proceed to
NEXTOUTER state the same as we used to do.  After we've found that there's
no need to return to the marked position, we can go to SKIPINNER_ADVANCE
state instead of SKIP_TEST when the inner tuple is unmatchable; this
preserves the performance improvement.  Per bug report from Bruce.
I also made a couple of cosmetic code rearrangements and added a regression
test for the problem.
src/backend/executor/nodeMergejoin.c
src/test/regress/expected/join.out
src/test/regress/expected/join_1.out
src/test/regress/sql/join.sql