Fix PHJ match bit initialization.
authorThomas Munro <[email protected]>
Thu, 13 Apr 2023 22:52:58 +0000 (10:52 +1200)
committerThomas Munro <[email protected]>
Thu, 13 Apr 2023 23:02:38 +0000 (11:02 +1200)
commit558c9d75fe3b38508296840e606737c664fc3b70
tree9eb153d208e44a8aba183890f912750bef99dafc
parenta28269708844246fb1ec00a536b391cac0a64972
Fix PHJ match bit initialization.

Hash join tuples reuse the HOT status bit to indicate match status
during hash join execution. Correct reuse requires clearing the bit in
all tuples. Serial hash join and parallel multi-batch hash join do so
upon inserting the tuple into the hashtable. Single batch parallel hash
join and batch 0 of unexpected multi-batch hash joins forgot to do this.

It hadn't come up before because hashtable tuple match bits are only
used for right and full outer joins and parallel ROJ and FOJ were
unsupported. 11c2d6fdf5 introduced support for parallel ROJ/FOJ but
neglected to ensure the match bits were reset.

Author: Melanie Plageman <[email protected]>
Reported-by: Richard Guo <[email protected]>
Discussion: https://postgr.es/m/flat/CAMbWs48Nde1Mv%3DBJv6_vXmRKHMuHZm2Q_g4F6Z3_pn%2B3EV6BGQ%40mail.gmail.com
src/backend/executor/nodeHash.c
src/test/regress/expected/join_hash.out
src/test/regress/sql/join_hash.sql