46 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
47 errmsg(
"argument \"%s\" must not be null",
48 arginfo[argnum].argname)));
73 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
74 errmsg(
"argument \"%s\" must not be a multidimensional array",
75 arginfo[argnum].argname)));
82 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
83 errmsg(
"argument \"%s\" array must not contain null values",
84 arginfo[argnum].argname)));
102 int argnum1,
int argnum2)
109 int nullarg =
PG_ARGISNULL(argnum1) ? argnum1 : argnum2;
110 int otherarg =
PG_ARGISNULL(argnum1) ? argnum2 : argnum1;
113 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
114 errmsg(
"argument \"%s\" must be specified when argument \"%s\" is specified",
115 arginfo[nullarg].argname,
116 arginfo[otherarg].argname)));
135 Oid table_oid = relId;
145 if (relId != oldRelId &&
OidIsValid(*locked_oid))
157 if (relkind == RELKIND_INDEX ||
158 relkind == RELKIND_PARTITIONED_INDEX)
165 if (relId == oldRelId)
174 if (table_oid == relId &&
OidIsValid(*locked_oid))
176 (
errcode(ERRCODE_UNDEFINED_OBJECT),
177 errmsg(
"index \"%s\" was concurrently dropped",
189 if (table_oid != relId && table_oid != *locked_oid)
191 (
errcode(ERRCODE_UNDEFINED_OBJECT),
192 errmsg(
"index \"%s\" was concurrently created",
198 elog(
ERROR,
"cache lookup failed for OID %u", table_oid);
202 switch (form->relkind)
204 case RELKIND_RELATION:
205 case RELKIND_MATVIEW:
206 case RELKIND_FOREIGN_TABLE:
207 case RELKIND_PARTITIONED_TABLE:
211 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
212 errmsg(
"cannot modify statistics for relation \"%s\"",
217 if (form->relisshared)
219 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
220 errmsg(
"cannot modify statistics for shared relation")));
238 if (relId != oldRelId && table_oid != relId)
241 *locked_oid = table_oid;
255 for (argnum = 0; arginfo[argnum].
argname != NULL; argnum++)
260 (
errmsg(
"unrecognized argument name: \"%s\"", argname)));
271 if (argtype != expectedtype)
274 (
errmsg(
"argument \"%s\" has type %s, expected type %s",
304 for (
int i = 0; arginfo[
i].
argname != NULL;
i++)
315 errmsg(
"variadic arguments must be name/value pairs"),
316 errhint(
"Provide an even number of variadic arguments that can be divided into pairs."));
323 for (
int i = 0;
i < nargs;
i += 2)
330 (
errmsg(
"name at variadic position %d is null",
i + 1)));
334 (
errmsg(
"name at variadic position %d has type %s, expected type %s",
356 arginfo[argnum].argtype))
363 positional_fcinfo->
args[argnum].
isnull =
false;
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)
#define TextDatumGetCString(d)
#define OidIsValid(objectId)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#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
char get_rel_relkind(Oid relid)
ObjectType get_relkind_objtype(char relkind)
int errdetail_relkind_not_supported(char relkind)
FormData_pg_class * Form_pg_class
int pg_strcasecmp(const char *s1, const char *s2)
static Datum ObjectIdGetDatum(Oid X)
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)
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 stats_check_required_arg(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum)
bool stats_check_arg_pair(FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum1, int argnum2)
NullableDatum args[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)