summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/joinpath.c
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2019-06-18 22:38:30 +1200
committerThomas Munro <tmunro@postgresql.org>2019-06-19 01:25:57 +1200
commitaca127c105aae551620d607e88d76930e6b9a2cf (patch)
tree0bfa491870fa91d9c93396589af251c4e3f27623 /src/backend/optimizer/path/joinpath.c
parent0ab7110bcbcce5ff58afb32e7871c54e87502139 (diff)
downloadpostgresql-aca127c105aae551620d607e88d76930e6b9a2cf.tar.gz
Prevent Parallel Hash Join for JOIN_UNIQUE_INNER.
WHERE EXISTS (...) queries cannot be executed by Parallel Hash Join with jointype JOIN_UNIQUE_INNER, because there is no way to make a partial plan totally unique. The consequence of allowing such plans was duplicate results from some EXISTS queries. Back-patch to 11. Bug #15857. Author: Thomas Munro Reviewed-by: Tom Lane Reported-by: Vladimir Kriukov Discussion: https://postgr.es/m/15857-d1ba2a64bce0795e%40postgresql.org
Diffstat (limited to 'src/backend/optimizer/path/joinpath.c')
-rw-r--r--src/backend/optimizer/path/joinpath.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index 501ad775cb..dc28b56e74 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -1867,9 +1867,12 @@ hash_inner_and_outer(PlannerInfo *root,
/*
* Can we use a partial inner plan too, so that we can build a
- * shared hash table in parallel?
+ * shared hash table in parallel? We can't handle
+ * JOIN_UNIQUE_INNER because we can't guarantee uniqueness.
*/
- if (innerrel->partial_pathlist != NIL && enable_parallel_hash)
+ if (innerrel->partial_pathlist != NIL &&
+ save_jointype != JOIN_UNIQUE_INNER &&
+ enable_parallel_hash)
{
cheapest_partial_inner =
(Path *) linitial(innerrel->partial_pathlist);