Anonymous committed 4eeda92

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.

  • Participants
  • Parent commits d43760b
  • Branches jsonbuild, master

Comments (0)

Files changed (1)

File src/backend/utils/adt/rangetypes_typanalyze.c

 #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);
 	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;