PostGIS  2.2.7dev-r@@SVN_REVISION@@
static ND_STATS* pg_get_nd_stats ( const Oid  table_oid,
AttrNumber  att_num,
int  mode 
)
static

Pull the stats object from the PgSQL system catalogs.

Used by the selectivity functions and the debugging functions.

Definition at line 838 of file gserialized_estimate.c.

References pg_nd_stats_from_tuple().

Referenced by gserialized_gist_joinsel(), and pg_get_nd_stats_by_name().

839 {
840  HeapTuple stats_tuple;
841  ND_STATS *nd_stats;
842 
843  /* First pull the stats tuple */
844  stats_tuple = SearchSysCache2(STATRELATT, table_oid, att_num);
845  if ( ! stats_tuple )
846  {
847  POSTGIS_DEBUGF(2, "stats for \"%s\" do not exist", get_rel_name(table_oid)? get_rel_name(table_oid) : "NULL");
848  return NULL;
849  }
850 
851  nd_stats = pg_nd_stats_from_tuple(stats_tuple, mode);
852  ReleaseSysCache(stats_tuple);
853  if ( ! nd_stats )
854  {
855  POSTGIS_DEBUGF(2,
856  "histogram for attribute %d of table \"%s\" does not exist?",
857  att_num, get_rel_name(table_oid));
858  }
859 
860  return nd_stats;
861 }
static ND_STATS * pg_nd_stats_from_tuple(HeapTuple stats_tuple, int mode)
N-dimensional statistics structure.

Here is the call graph for this function:

Here is the caller graph for this function: