1948{
1949 Oid table_oid = PG_GETARG_OID(0);
1950 text *att_text = PG_GETARG_TEXT_P(1);
1951 Datum geom_datum = PG_GETARG_DATUM(2);
1953 float8 selectivity = 0;
1955 int mode = 2;
1956
1957
1958 if ( ! PG_ARGISNULL(3) )
1960
1961
1963
1964 if ( ! nd_stats )
1965 elog(ERROR, "stats for \"%s.%s\" do not exist", get_rel_name(table_oid), text_to_cstring(att_text));
1966
1967
1969 elog(ERROR, "unable to calculate bounding box from geometry");
1970
1972
1973
1975
1976 pfree(nd_stats);
1977 PG_RETURN_FLOAT8(selectivity);
1978}
char * gbox_to_string(const GBOX *gbox)
Allocate a string representation of the GBOX, based on dimensionality of flags.
static float8 estimate_selectivity(const GBOX *box, const ND_STATS *nd_stats, int mode)
This function returns an estimate of the selectivity of a search GBOX by looking at data in the ND_ST...
static int text_p_get_mode(const text *txt)
Utility function to see if the first letter of the mode argument is 'N'.
static ND_STATS * pg_get_nd_stats_by_name(const Oid table_oid, const text *att_text, int mode, bool only_parent)
Pull the stats object from the PgSQL system catalogs.
int gserialized_datum_get_gbox_p(Datum gsdatum, GBOX *gbox)
Given a GSERIALIZED datum, as quickly as possible (peaking into the top of the memory) return the gbo...