Hi hackers,

When calculating selectivity for an inner equijoin, we call eqjoinsel_inner, which uses unused parameters vardata1 and vardata2. These parameters might have been left behind accidentally when we moved getting sslots out of the function. I suggest removing them, as they can be added back at any time if needed. I attached patch with fixes.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.
From 1bf58c5725ab9a906f57117a2c2e1ee7f287f5d5 Mon Sep 17 00:00:00 2001
From: Ilia Evdokimov <ilya.evdoki...@tantorlabs.com>
Date: Fri, 21 Feb 2025 12:38:13 +0300
Subject: [PATCH v1] Remove unused vardata parameters in eqjoinsel_inner.

The vardata parameters in eqjoinsel_inner are unused, so remove them.
This is a static function, so the parameters can easily be added again if
they are ever needed.
---
 src/backend/utils/adt/selfuncs.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index c2918c9c83..63b408bdcc 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -150,7 +150,6 @@ get_index_stats_hook_type get_index_stats_hook = NULL;
 
 static double eqsel_internal(PG_FUNCTION_ARGS, bool negate);
 static double eqjoinsel_inner(Oid opfuncoid, Oid collation,
-							  VariableStatData *vardata1, VariableStatData *vardata2,
 							  double nd1, double nd2,
 							  bool isdefault1, bool isdefault2,
 							  AttStatsSlot *sslot1, AttStatsSlot *sslot2,
@@ -2348,7 +2347,6 @@ eqjoinsel(PG_FUNCTION_ARGS)
 
 	/* We need to compute the inner-join selectivity in all cases */
 	selec_inner = eqjoinsel_inner(opfuncoid, collation,
-								  &vardata1, &vardata2,
 								  nd1, nd2,
 								  isdefault1, isdefault2,
 								  &sslot1, &sslot2,
@@ -2436,7 +2434,6 @@ eqjoinsel(PG_FUNCTION_ARGS)
  */
 static double
 eqjoinsel_inner(Oid opfuncoid, Oid collation,
-				VariableStatData *vardata1, VariableStatData *vardata2,
 				double nd1, double nd2,
 				bool isdefault1, bool isdefault2,
 				AttStatsSlot *sslot1, AttStatsSlot *sslot2,
-- 
2.34.1

Reply via email to