From fd37d6b50678d6638de4ad8a0a8cad232cadbac7 Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Mon, 17 Jun 2024 16:41:33 +0200 Subject: [PATCH v20240617 39/56] add the statistic_proc_security_check check. --- src/backend/statistics/extended_stats.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c index e7caa112ee7..08998f219e1 100644 --- a/src/backend/statistics/extended_stats.c +++ b/src/backend/statistics/extended_stats.c @@ -3371,14 +3371,10 @@ statext_clauselist_join_selectivity(PlannerInfo *root, List *clauses, { /* note we allow use of nullfrac regardless of security check */ stats = (Form_pg_statistic) GETSTRUCT(vardata.statsTuple); - - /* - * FIXME should this call statistic_proc_security_check like - * eqjoinsel? - */ - have_mcvs = get_attstatsslot(&sslot, vardata.statsTuple, - STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + if (statistic_proc_security_check(&vardata, F_EQJOINSEL)) + have_mcvs = get_attstatsslot(&sslot, vardata.statsTuple, + STATISTIC_KIND_MCV, InvalidOid, + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); } if (have_mcvs) @@ -3415,14 +3411,10 @@ statext_clauselist_join_selectivity(PlannerInfo *root, List *clauses, { /* note we allow use of nullfrac regardless of security check */ stats = (Form_pg_statistic) GETSTRUCT(vardata.statsTuple); - - /* - * FIXME should this call statistic_proc_security_check like - * eqjoinsel? - */ - have_mcvs = get_attstatsslot(&sslot, vardata.statsTuple, - STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + if (statistic_proc_security_check(&vardata, F_EQJOINSEL)) + have_mcvs = get_attstatsslot(&sslot, vardata.statsTuple, + STATISTIC_KIND_MCV, InvalidOid, + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); } if (have_mcvs) -- 2.45.2