29#include "utils/fmgroids.h"
180 errmsg(
"recovery is in progress"),
181 errhint(
"Statistics cannot be modified during recovery.")));
194 errmsg(
"cannot specify both \"%s\" and \"%s\"",
"attname",
"attnum")));
201 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
213 errmsg(
"column %d of relation \"%s\" does not exist",
220 errmsg(
"must specify either \"%s\" or \"%s\"",
"attname",
"attnum")));
228 errmsg(
"cannot modify statistics on system column \"%s\"",
292 (
errmsg(
"could not determine element type of column \"%s\"",
attname),
294 "STATISTIC_KIND_MCELEM",
"STATISTIC_KIND_DECHIST")));
309 errmsg(
"could not determine less-than operator for column \"%s\"",
attname),
311 "STATISTIC_KIND_HISTOGRAM",
"STATISTIC_KIND_CORRELATION")));
326 "STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM",
"STATISTIC_KIND_BOUNDS_HISTOGRAM")));
379 stanumbers,
false, stavalues,
false);
402 0,
true, stavalues,
false);
418 stanumbers,
false, 0,
true);
439 stanumbers,
false, stavalues,
false);
453 stanumbers,
false, 0,
true);
479 0,
true, stavalues,
false);
506 stanumbers,
false, stavalues,
false);
602 errmsg(
"recovery is in progress"),
603 errhint(
"Statistics cannot be modified during recovery.")));
615 errmsg(
"cannot clear statistics on system column \"%s\"",
621 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
#define InvalidAttrNumber
static bool delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit)
@ RANGE_LENGTH_HISTOGRAM_ARG
@ RANGE_BOUNDS_HISTOGRAM_ARG
@ NUM_ATTRIBUTE_STATS_ARGS
@ ELEM_COUNT_HISTOGRAM_ARG
@ MOST_COMMON_ELEM_FREQS_ARG
static struct StatsArgInfo cleararginfo[]
static void upsert_pg_statistic(Relation starel, HeapTuple oldtup, const Datum *values, const bool *nulls, const bool *replaces)
static struct StatsArgInfo attarginfo[]
static bool attribute_statistics_update(FunctionCallInfo fcinfo)
clear_attribute_stats_argnum
@ C_NUM_ATTRIBUTE_STATS_ARGS
Datum pg_clear_attribute_stats(PG_FUNCTION_ARGS)
Datum pg_restore_attribute_stats(PG_FUNCTION_ARGS)
static Datum values[MAXATTR]
#define TextDatumGetCString(d)
#define OidIsValid(objectId)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
#define PG_GETARG_DATUM(n)
#define LOCAL_FCINFO(name, nargs)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_BOOL(x)
#define PG_GETARG_INT16(n)
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
void CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid)
#define ShareUpdateExclusiveLock
char * get_rel_name(Oid relid)
AttrNumber get_attnum(Oid relid, const char *attname)
char * get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
static Datum PointerGetDatum(const void *X)
static Datum Int16GetDatum(int16 X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
#define RelationGetDescr(relation)
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)
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)
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)
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)
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache3(int cacheId, Datum key1, Datum key2, Datum key3)
bool SearchSysCacheExistsAttName(Oid relid, const char *attname)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
void CommandCounterIncrement(void)
bool RecoveryInProgress(void)