25#include "utils/fmgroids.h"
26#include "utils/fmgrprotos.h"
72 bool update_relpages =
false;
74 bool update_reltuples =
false;
76 bool update_relallvisible =
false;
78 bool update_relallfrozen =
false;
81 int replaces[4] = {0};
96 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
97 errmsg(
"recovery is in progress"),
98 errhint(
"Statistics cannot be modified during recovery.")));
105 update_relpages =
true;
111 if (reltuples < -1.0)
114 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
115 errmsg(
"reltuples cannot be < -1.0")));
119 update_reltuples =
true;
125 update_relallvisible =
true;
131 update_relallfrozen =
true;
142 elog(
ERROR,
"pg_class entry for relid %u not found", reloid);
146 if (update_relpages && relpages != pgcform->relpages)
148 replaces[nreplaces] = Anum_pg_class_relpages;
153 if (update_reltuples && reltuples != pgcform->reltuples)
155 replaces[nreplaces] = Anum_pg_class_reltuples;
160 if (update_relallvisible && relallvisible != pgcform->relallvisible)
162 replaces[nreplaces] = Anum_pg_class_relallvisible;
167 if (update_relallfrozen && relallfrozen != pgcform->relallfrozen)
169 replaces[nreplaces] = Anum_pg_class_relallfrozen;
211 newfcinfo->args[2].isnull =
false;
213 newfcinfo->args[3].isnull =
false;
215 newfcinfo->args[4].isnull =
false;
217 newfcinfo->args[5].isnull =
false;
static Datum values[MAXATTR]
#define TextDatumGetCString(d)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_GETARG_UINT32(n)
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
#define PG_GETARG_DATUM(n)
#define LOCAL_FCINFO(name, nargs)
#define PG_GETARG_FLOAT4(n)
#define PG_RETURN_BOOL(x)
HeapTuple heap_modify_tuple_by_cols(HeapTuple tuple, TupleDesc tupleDesc, int nCols, const int *replCols, const Datum *replValues, const bool *replIsnull)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
FormData_pg_class * Form_pg_class
static Datum Float4GetDatum(float4 X)
static Datum ObjectIdGetDatum(Oid X)
static Datum UInt32GetDatum(uint32 X)
#define RelationGetDescr(relation)
static struct StatsArgInfo relarginfo[]
@ NUM_RELATION_STATS_ARGS
Datum pg_restore_relation_stats(PG_FUNCTION_ARGS)
static bool relation_statistics_update(FunctionCallInfo fcinfo)
Datum pg_clear_relation_stats(PG_FUNCTION_ARGS)
bool stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo, FunctionCallInfo positional_fcinfo, struct StatsArgInfo *arginfo)
void stats_check_required_arg(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
void stats_lock_check_privileges(Oid reloid)
Oid stats_lookup_relid(const char *nspname, const char *relname)
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
void CommandCounterIncrement(void)
bool RecoveryInProgress(void)