aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/variable.c
diff options
context:
space:
mode:
authorRichard Guo <rguo@postgresql.org>2024-09-04 12:17:11 +0900
committerRichard Guo <rguo@postgresql.org>2024-09-04 12:17:11 +0900
commit4f1124548f6f3c7dea639ccd3d3f234cf70faf0a (patch)
tree89aca1dc3c869729e3874c06b42ba48ffdd41970 /src/backend/commands/variable.c
parent08b9b9e043bb42c12f5cd7439b9c19833fe877d0 (diff)
downloadpostgresql-4f1124548f6f3c7dea639ccd3d3f234cf70faf0a.tar.gz
postgresql-4f1124548f6f3c7dea639ccd3d3f234cf70faf0a.zip
Check the validity of commutators for merge/hash clauses
When creating merge or hash join plans in createplan.c, the merge or hash clauses may need to get commuted to ensure that the outer var is on the left and the inner var is on the right if they are not already in the expected form. This requires that their operators have commutators. Failing to find a commutator at this stage would result in 'ERROR: could not find commutator for operator xxx', with no opportunity to select an alternative plan. Typically, this is not an issue because mergejoinable or hashable operators are expected to always have valid commutators. But in some artificial cases this assumption may not hold true. Therefore, here in this patch we check the validity of commutators for clauses in the form "inner op outer" when selecting mergejoin/hash clauses, and consider a clause unusable for the current pair of outer and inner relations if it lacks a commutator. There are not (and should not be) any such operators built into Postgres that are mergejoinable or hashable but have no commutators; so we leverage the alias type 'int8alias1' created in equivclass.sql to build the test case. This is why the test case is included in equivclass.sql rather than in join.sql. Although this is arguably a bug fix, it cannot be reproduced without installing an incomplete opclass, which is unlikely to happen in practice, so no back-patch. Reported-by: Alexander Pyhalov Author: Richard Guo Reviewed-by: Tom Lane Discussion: https://postgr.es/m/c59ec04a2fef94d9ffc35a9b17dfc081@postgrespro.ru
Diffstat (limited to 'src/backend/commands/variable.c')
0 files changed, 0 insertions, 0 deletions