23 #include "utils/fmgrprotos.h"
26 #define DEFAULT_RELPAGES Int32GetDatum(0)
27 #define DEFAULT_RELTUPLES Float4GetDatum(-1.0)
28 #define DEFAULT_RELALLVISIBLE Int32GetDatum(0)
65 int replaces[3] = {0};
89 (
errcode(ERRCODE_OBJECT_IN_USE),
90 errmsg(
"pg_class entry for relid %u not found", reloid)));
110 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
111 errmsg(
"relpages cannot be < -1")));
116 if (relpages != pgcform->relpages)
118 replaces[ncols] = Anum_pg_class_relpages;
128 if (reltuples < -1.0)
131 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
132 errmsg(
"reltuples cannot be < -1.0")));
137 if (reltuples != pgcform->reltuples)
139 replaces[ncols] = Anum_pg_class_reltuples;
149 if (relallvisible < 0)
152 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
153 errmsg(
"relallvisible cannot be < 0")));
158 if (relallvisible != pgcform->relallvisible)
160 replaces[ncols] = Anum_pg_class_relallvisible;
209 newfcinfo->args[1].isnull =
false;
211 newfcinfo->args[2].isnull =
false;
213 newfcinfo->args[3].isnull =
false;
static Datum values[MAXATTR]
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)
#define LOCAL_FCINFO(name, nargs)
#define PG_GETARG_INT32(n)
#define PG_GETARG_FLOAT4(n)
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)
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 Int32GetDatum(int32 X)
#define RelationGetDescr(relation)
static struct StatsArgInfo relarginfo[]
@ NUM_RELATION_STATS_ARGS
static bool relation_statistics_update(FunctionCallInfo fcinfo, int elevel)
#define DEFAULT_RELTUPLES
#define DEFAULT_RELALLVISIBLE
Datum pg_set_relation_stats(PG_FUNCTION_ARGS)
Datum pg_clear_relation_stats(PG_FUNCTION_ARGS)
void stats_check_required_arg(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
void stats_lock_check_privileges(Oid reloid)
#define SearchSysCacheCopy1(cacheId, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)