aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes/pathnodes.h
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-01-09 00:08:35 +0200
committerAlexander Korotkov <akorotkov@postgresql.org>2024-01-09 00:09:06 +0200
commit30b4955a4668887044568743debef804b14418ca (patch)
tree9f50aaf37ede4ff7a7711148b0b5f12cf6ce0957 /src/include/nodes/pathnodes.h
parentd3c5f37dd543498cc7c678815d3921823beec9e9 (diff)
downloadpostgresql-30b4955a4668887044568743debef804b14418ca.tar.gz
postgresql-30b4955a4668887044568743debef804b14418ca.zip
Fix misuse of RelOptInfo.unique_for_rels cache by SJE
When SJE uses RelOptInfo.unique_for_rels cache, it passes filtered quals to innerrel_is_unique_ext(). That might lead to an invalid match to cache entries made by previous non self-join checking calls. Add UniqueRelInfo.self_join flag to prevent such cases. Also, fix that SJE should require a strict match of outerrelids to make sure UniqueRelInfo.extra_clauses are valid. Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/4788f781-31bd-9796-d7d6-588a751c8787%40gmail.com
Diffstat (limited to 'src/include/nodes/pathnodes.h')
-rw-r--r--src/include/nodes/pathnodes.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index bb34cfb843f..b9713ec9aa6 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -3408,6 +3408,12 @@ typedef struct UniqueRelInfo
Relids outerrelids;
/*
+ * The relation in consideration is unique when considering only clauses
+ * suitable for self-join (passed split_selfjoin_quals()).
+ */
+ bool self_join;
+
+ /*
* Additional clauses from a baserestrictinfo list that were used to prove
* the uniqueness. We cache it for the self-join checking procedure: a
* self-join can be removed if the outer relation contains strictly the