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.
This commit is contained in:
Tom Lane 2013-12-23 22:18:12 -05:00
parent d43760b624
commit 4eeda92d86

View File

@ -27,6 +27,7 @@
#include "catalog/pg_operator.h" #include "catalog/pg_operator.h"
#include "commands/vacuum.h" #include "commands/vacuum.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/rangetypes.h" #include "utils/rangetypes.h"
static int float8_qsort_cmp(const void *a1, const void *a2); static int float8_qsort_cmp(const void *a1, const void *a2);
@ -44,8 +45,8 @@ range_typanalyze(PG_FUNCTION_ARGS)
TypeCacheEntry *typcache; TypeCacheEntry *typcache;
Form_pg_attribute attr = stats->attr; Form_pg_attribute attr = stats->attr;
/* Get information about range type */ /* Get information about range type; note column might be a domain */
typcache = range_get_typcache(fcinfo, stats->attrtypid); typcache = range_get_typcache(fcinfo, getBaseType(stats->attrtypid));
if (attr->attstattarget < 0) if (attr->attstattarget < 0)
attr->attstattarget = default_statistics_target; attr->attstattarget = default_statistics_target;