42#define DEFAULT_STATATT_NULL_FRAC Float4GetDatum(0.0)
43#define DEFAULT_STATATT_AVG_WIDTH Int32GetDatum(0)
45#define DEFAULT_STATATT_N_DISTINCT Float4GetDatum(0.0)
61 errmsg(
"argument \"%s\" must not be null",
88 errmsg(
"argument \"%s\" must not be a multidimensional array",
97 errmsg(
"argument \"%s\" array must not contain null values",
128 errmsg(
"argument \"%s\" must be specified when argument \"%s\" is specified",
191 errmsg(
"index \"%s\" was concurrently dropped",
206 errmsg(
"index \"%s\" was concurrently created",
216 switch (
form->relkind)
226 errmsg(
"cannot modify statistics for relation \"%s\"",
231 if (
form->relisshared)
234 errmsg(
"cannot modify statistics for shared relation")));
274 (
errmsg(
"unrecognized argument name: \"%s\"", argname)));
288 (
errmsg(
"argument \"%s\" has type %s, expected type %s",
332 if (rel->
rd_index->indkey.values[
i] == 0)
336 elog(
ERROR,
"too few entries in indexprs list");
373 errmsg(
"variadic arguments must be name/value pairs"),
374 errhint(
"Provide an even number of variadic arguments that can be divided into pairs."));
381 for (
int i = 0;
i < nargs;
i += 2)
388 (
errmsg(
"name at variadic position %d is null",
i + 1)));
392 (
errmsg(
"name at variadic position %d has type %s, expected type %s",
458 errmsg(
"column %d of relation \"%s\" does not exist",
463 if (attr->attisdropped)
466 errmsg(
"column %d of relation \"%s\" does not exist",
479 *atttypid = attr->atttypid;
480 *atttypmod = attr->atttypmod;
505 *eq_opr = typcache->
eq_opr;
506 *lt_opr = typcache->
lt_opr;
606 errmsg(
"\"%s\" array must not contain null values",
staname)));
664 (
errmsg(
"maximum number of statistics slots exceeded: %d",
781 &elems, &nulls, &nelems);
783 for (
int i = 0;
i < nelems;
i++)
800 errmsg(
"\"%s\" must not contain empty ranges",
801 "range_bounds_histogram")));
811 errmsg(
"\"%s\" must have its lower and upper bounds sorted in ascending order",
812 "range_bounds_histogram")));
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
#define DatumGetArrayTypeP(X)
bool array_contains_nulls(const ArrayType *array)
Datum array_in(PG_FUNCTION_ARGS)
void deconstruct_array(const ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)
static Datum values[MAXATTR]
#define TextDatumGetCString(d)
#define OidIsValid(objectId)
void ThrowErrorData(ErrorData *edata)
int errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
bool InputFunctionCallSafe(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod, Node *escontext, Datum *result)
#define PG_GETARG_DATUM(n)
int extract_variadic_args(FunctionCallInfo fcinfo, int variadic_start, bool convert_unknown, Datum **args, Oid **types, bool **nulls)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
Oid IndexGetRelation(Oid indexId, bool missing_ok)
void UnlockRelationOid(Oid relid, LOCKMODE lockmode)
void LockRelationOid(Oid relid, LOCKMODE lockmode)
#define ShareUpdateExclusiveLock
Oid get_multirange_range(Oid multirangeOid)
void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)
char get_rel_relkind(Oid relid)
Oid get_base_element_type(Oid typid)
bool type_is_multirange(Oid typid)
void pfree(void *pointer)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
ObjectType get_relkind_objtype(char relkind)
Datum lower(PG_FUNCTION_ARGS)
Datum upper(PG_FUNCTION_ARGS)
FormData_pg_attribute * Form_pg_attribute
int errdetail_relkind_not_supported(char relkind)
FormData_pg_class * Form_pg_class
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
#define STATISTIC_NUM_SLOTS
int pg_strcasecmp(const char *s1, const char *s2)
static Oid DatumGetObjectId(Datum X)
static Datum Int16GetDatum(int16 X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static int16 DatumGetInt16(Datum X)
int range_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *b1, const RangeBound *b2)
void range_deserialize(TypeCacheEntry *typcache, const RangeType *range, RangeBound *lower, RangeBound *upper, bool *empty)
static RangeType * DatumGetRangeTypeP(Datum X)
#define RelationGetRelationName(relation)
List * RelationGetIndexExpressions(Relation relation)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
#define DEFAULT_STATATT_NULL_FRAC
bool statatt_get_elem_type(Oid atttypid, char atttyptype, Oid *elemtypid, Oid *elem_eq_opr)
Datum statatt_build_stavalues(const char *staname, FmgrInfo *array_in, Datum d, Oid typid, int32 typmod, bool *ok)
bool stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo, FunctionCallInfo positional_fcinfo, struct StatsArgInfo *arginfo)
static int get_arg_by_name(const char *argname, struct StatsArgInfo *arginfo)
void RangeVarCallbackForStats(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
void statatt_init_empty_tuple(Oid reloid, int16 attnum, bool inherited, Datum *values, bool *nulls, bool *replaces)
#define DEFAULT_STATATT_AVG_WIDTH
static bool stats_check_arg_type(const char *argname, Oid argtype, Oid expectedtype)
bool stats_check_arg_array(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
void statatt_get_type(Oid reloid, AttrNumber attnum, Oid *atttypid, int32 *atttypmod, char *atttyptype, Oid *atttypcoll, Oid *eq_opr, Oid *lt_opr)
void stats_check_required_arg(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
bool statatt_check_bounds_histogram(Datum arrayval)
static Node * statatt_get_index_expr(Relation rel, int attnum)
#define DEFAULT_STATATT_N_DISTINCT
void statatt_set_slot(Datum *values, bool *nulls, bool *replaces, int16 stakind, Oid staop, Oid stacoll, Datum stanumbers, bool stanumbers_isnull, Datum stavalues, bool stavalues_isnull)
bool stats_check_arg_pair(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum1, int argnum2)
struct TypeCacheEntry * rngelemtype
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache2(SysCacheIdentifier cacheId, Datum key1, Datum key2)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
#define TYPECACHE_RANGE_INFO