From 4eeda92d86250b702ee6f88fcad2340e5e7d8747 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 23 Dec 2013 22:18:12 -0500 Subject: [PATCH] Fix ANALYZE failure on a column that's a domain over a range. Most other range operations seem to work all right on domains, but this one not so much, at least not since commit 918eee0c. Per bug #8684 from Brett Neumeier. --- src/backend/utils/adt/rangetypes_typanalyze.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/rangetypes_typanalyze.c b/src/backend/utils/adt/rangetypes_typanalyze.c index 114bce015c..43c0b7e78b 100644 --- a/src/backend/utils/adt/rangetypes_typanalyze.c +++ b/src/backend/utils/adt/rangetypes_typanalyze.c @@ -27,6 +27,7 @@ #include "catalog/pg_operator.h" #include "commands/vacuum.h" #include "utils/builtins.h" +#include "utils/lsyscache.h" #include "utils/rangetypes.h" static int float8_qsort_cmp(const void *a1, const void *a2); @@ -44,8 +45,8 @@ range_typanalyze(PG_FUNCTION_ARGS) TypeCacheEntry *typcache; Form_pg_attribute attr = stats->attr; - /* Get information about range type */ - typcache = range_get_typcache(fcinfo, stats->attrtypid); + /* Get information about range type; note column might be a domain */ + typcache = range_get_typcache(fcinfo, getBaseType(stats->attrtypid)); if (attr->attstattarget < 0) attr->attstattarget = default_statistics_target; -- 2.40.0