From c69bdf837f161ae3e699496be10215dbb2315917 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 3 Jul 2023 07:09:22 +0200 Subject: Take pg_attribute out of VacAttrStats The VacAttrStats structure contained the whole Form_pg_attribute for a column, but it actually only needs attstattarget from there. So remove the Form_pg_attribute field and make a separate field for attstattarget. This simplifies some code for extended statistics that doesn't deal with a column but an expression, which had to fake up pg_attribute rows to satisfy internal APIs. Also, we can remove some comments that essentially said "don't look at pg_attribute directly". Reviewed-by: Tomas Vondra Discussion: https://www.postgresql.org/message-id/flat/d6069765-5971-04d3-c10d-e4f7b2e9c459%40eisentraut.org --- src/backend/utils/adt/array_typanalyze.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/utils/adt/array_typanalyze.c') diff --git a/src/backend/utils/adt/array_typanalyze.c b/src/backend/utils/adt/array_typanalyze.c index 52e160d6bbb..04b3764b686 100644 --- a/src/backend/utils/adt/array_typanalyze.c +++ b/src/backend/utils/adt/array_typanalyze.c @@ -263,7 +263,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, * the number of individual elements tracked in pg_statistic ought to be * more than the number of values for a simple scalar column. */ - num_mcelem = stats->attr->attstattarget * 10; + num_mcelem = stats->attstattarget * 10; /* * We set bucket width equal to num_mcelem / 0.007 as per the comment @@ -575,7 +575,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, count_items_count = hash_get_num_entries(count_tab); if (count_items_count > 0) { - int num_hist = stats->attr->attstattarget; + int num_hist = stats->attstattarget; DECountItem **sorted_count_items; int j; int delta; -- cgit v1.2.3