2311 char *nsp_tbl = NULL;
2312 Oid tbl_oid, idx_oid;
2315 bool only_parent =
false;
2318 if ( PG_NARGS() == 4 )
2322 col = PG_GETARG_TEXT_P(2);
2323 only_parent = PG_GETARG_BOOL(3);
2324 nsp_tbl = palloc(strlen(nsp) + strlen(tbl) + 6);
2325 sprintf(nsp_tbl,
"\"%s\".\"%s\"", nsp, tbl);
2326 tbl_oid = DatumGetObjectId(DirectFunctionCall1(regclassin, CStringGetDatum(nsp_tbl)));
2329 else if ( PG_NARGS() == 3 )
2333 col = PG_GETARG_TEXT_P(2);
2334 nsp_tbl = palloc(strlen(nsp) + strlen(tbl) + 6);
2335 sprintf(nsp_tbl,
"\"%s\".\"%s\"", nsp, tbl);
2336 tbl_oid = DatumGetObjectId(DirectFunctionCall1(regclassin, CStringGetDatum(nsp_tbl)));
2339 else if ( PG_NARGS() == 2 )
2342 col = PG_GETARG_TEXT_P(1);
2343 nsp_tbl = palloc(strlen(tbl) + 3);
2344 sprintf(nsp_tbl,
"\"%s\"", tbl);
2345 tbl_oid = DatumGetObjectId(DirectFunctionCall1(regclassin, CStringGetDatum(nsp_tbl)));
2350 elog(ERROR,
"estimated_extent() called with wrong number of arguments");
2358 elog(DEBUG2,
"index for \"%s.%s\" does not exist", tbl,
text_to_cstring(col));
2370 elog(WARNING,
"stats for \"%s.%s\" do not exist", tbl,
text_to_cstring(col));
2375 gbox = palloc(
sizeof(
GBOX));
2386 PG_RETURN_POINTER(gbox);
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.
static GBOX * spatial_index_read_extent(Oid idx_oid, int key_type)
static Oid table_get_spatial_index(Oid tbl_oid, text *col, int *key_type)
#define FLAGS_SET_GEODETIC(flags, value)
#define FLAGS_SET_M(flags, value)
#define FLAGS_SET_Z(flags, value)
char * text_to_cstring(const text *textptr)
N-dimensional statistics structure.