34#include "utils/fmgroids.h"
172 elog(
ERROR,
"stxkind is not a one-dimension char array");
193 elog(
ERROR,
"incorrect stxkind %c found", kinds[
i]);
304 errmsg(
"recovery is in progress"),
305 errhint(
"Statistics cannot be modified during recovery."));
338 errmsg(
"could not find schema \"%s\"", nspname));
350 errmsg(
"could not find extended statistics object \"%s\".\"%s\"",
363 if (
stxform->stxrelid != relid)
367 errmsg(
"could not restore extended statistics object \"%s\".\"%s\": incorrect relation \"%s\".\"%s\" specified",
421 errmsg(
"cannot specify parameter \"%s\"",
423 errhint(
"Extended statistics object \"%s\".\"%s\" does not support statistics of this type.",
427 has.ndistinct =
false;
439 errmsg(
"cannot specify parameter \"%s\"",
441 errhint(
"Extended statistics object \"%s\".\"%s\" does not support statistics of this type.",
444 has.dependencies =
false;
462 errmsg(
"cannot specify parameters \"%s\", \"%s\" or \"%s\"",
466 errhint(
"Extended statistics object \"%s\".\"%s\" does not support statistics of this type.",
487 errmsg(
"could not use \"%s\", \"%s\" and \"%s\": missing one or more parameters",
530 if (attr->attisdropped)
534 atttypmods[
i] = attr->atttypmod;
598 if (
has.dependencies)
648 if (atttypmods !=
NULL)
667 errmsg(
"could not parse array \"%s\": incorrect number of dimensions (%d required)",
676 errmsg(
"could not parse array \"%s\": NULL value found",
685 errmsg(
"could not parse array \"%s\": incorrect number of elements (same as \"%s\" required)",
720 errmsg(
"could not parse array \"%s\": incorrect number of dimensions (%d required)",
729 errmsg(
"could not parse array \"%s\": found %d attributes but expected %d",
858 errmsg(
"recovery is in progress"),
859 errhint(
"Statistics cannot be modified during recovery."));
879 errmsg(
"could not find schema \"%s\"", nspname));
891 errmsg(
"could not find extended statistics object \"%s\".\"%s\"",
902 if (
stxform->stxrelid != relid)
907 errmsg(
"could not clear extended statistics object \"%s\".\"%s\": incorrect relation \"%s\".\"%s\" specified",
#define PG_GETARG_ARRAYTYPE_P(n)
#define DatumGetArrayTypeP(X)
bool array_contains_nulls(const ArrayType *array)
void deconstruct_array_builtin(const ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)
static Datum values[MAXATTR]
static void cleanup(void)
#define TextDatumGetCString(d)
#define Assert(condition)
#define OidIsValid(objectId)
Node * eval_const_expressions(PlannerInfo *root, Node *node)
MVDependencies * statext_dependencies_deserialize(bytea *data)
bool statext_dependencies_validate(const MVDependencies *dependencies, const int2vector *stxkeys, int numexprs, int elevel)
void statext_dependencies_free(MVDependencies *dependencies)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
@ NUM_EXTENDED_STATS_ARGS
@ MOST_COMMON_BASE_FREQS_ARG
Datum pg_clear_extended_stats(PG_FUNCTION_ARGS)
static void upsert_pg_statistic_ext_data(const Datum *values, const bool *nulls, const bool *replaces)
static bool delete_pg_statistic_ext_data(Oid stxoid, bool inherited)
static struct StatsArgInfo extarginfo[]
Datum pg_restore_extended_stats(PG_FUNCTION_ARGS)
static void expand_stxkind(HeapTuple tup, StakindFlags *enabled)
static HeapTuple get_pg_statistic_ext(Relation pg_stext, Oid nspoid, const char *stxname)
static bool extended_statistics_update(FunctionCallInfo fcinfo)
static bool check_mcvlist_array(const ArrayType *arr, int argindex, int required_ndims, int mcv_length)
static Datum import_mcv(const ArrayType *mcv_arr, const ArrayType *freqs_arr, const ArrayType *base_freqs_arr, Oid *atttypids, int32 *atttypmods, Oid *atttypcolls, int numattrs, bool *ok)
#define palloc0_array(type, count)
#define DatumGetByteaPP(X)
#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)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
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_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *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_namespace_name(Oid nspid)
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Datum statext_mcv_import(int elevel, int numattrs, Oid *atttypids, int32 *atttypmods, Oid *atttypcolls, int nitems, Datum *mcv_elems, bool *mcv_nulls, float8 *freqs, float8 *base_freqs)
void pfree(void *pointer)
void statext_ndistinct_free(MVNDistinct *ndistinct)
MVNDistinct * statext_ndistinct_deserialize(bytea *data)
bool statext_ndistinct_validate(const MVNDistinct *ndistinct, const int2vector *stxkeys, int numexprs, int elevel)
Oid get_namespace_oid(const char *nspname, bool missing_ok)
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
void fix_opfuncids(Node *node)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
static void * list_nth(const List *list, int n)
FormData_pg_statistic_ext * Form_pg_statistic_ext
static Datum Int16GetDatum(int16 X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
void * stringToNode(const char *str)
#define RelationGetDescr(relation)
const char * quote_identifier(const char *ident)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
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 stats_check_required_arg(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
#define BTEqualStrategyNumber
void ReleaseSysCache(HeapTuple tuple)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
HeapTuple SearchSysCache2(int cacheId, Datum key1, Datum key2)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
#define SearchSysCacheCopy1(cacheId, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
void CommandCounterIncrement(void)
bool RecoveryInProgress(void)