From: Tom Lane Date: Tue, 24 Dec 2013 03:18:12 +0000 (-0500) Subject: Fix ANALYZE failure on a column that's a domain over a range. X-Git-Tag: REL9_4_BETA1~758 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4eeda92d86250b702ee6f88fcad2340e5e7d8747;p=postgresql 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. --- 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;