Commit 4eeda92d authored by Tom Lane's avatar Tom Lane

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.
parent d43760b6
...@@ -27,6 +27,7 @@ ...@@ -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) ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment