From 4369a6afa3437dec03a9237cc836c4205d5c56a1 Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tomas@2ndquadrant.com>
Date: Mon, 17 Jun 2024 14:29:11 +0200
Subject: [PATCH v20240617 05/56] review

---
 src/backend/optimizer/path/clausesel.c  | 5 +++++
 src/backend/statistics/extended_stats.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index a0ab95553bc..00d74e21bdd 100644
--- a/src/backend/optimizer/path/clausesel.c
+++ b/src/backend/optimizer/path/clausesel.c
@@ -213,8 +213,13 @@ clauselist_selectivity_ext(PlannerInfo *root,
 	 * t1 left join t2 ON t1.a = 3, but it can grantee we can't use extended
 	 * statistics for estimation since it has only 1 relid.
 	 *
+	 * XXX Is that actually behaving like that? Won't the (t1.a=3) be turned
+	 * into a regular clause? I haven't tried, though.
+	 *
 	 * XXX: so we can grantee estimatedclauses == NULL now, so estimatedclauses
 	 * in statext_try_join_estimates is removed.
+	 *
+	 * XXX Maybe remove the comment and add an assert estimatedclauses==NULL.
 	 */
 	if (use_extended_stats && rel == NULL &&
 		statext_try_join_estimates(root, clauses, varRelid, jointype, sjinfo))
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 71e47748d23..69a638a18b7 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -2837,6 +2837,8 @@ statext_is_supported_join_clause(PlannerInfo *root, Node *clause, SpecialJoinInf
 	ListCell   *lc;
 
 	/*
+	 * XXX isn't this comment stale after removal of varRelid?
+	 *
 	 * evaluation as a restriction clause, either at scan node or forced
 	 *
 	 * XXX See treat_as_join_clause.
-- 
2.45.2

