82 static const char *
getid(
const char *s,
char *n,
Node *escontext);
83 static void putid(
char *p,
const char *s);
144 bool in_quotes =
false;
148 while (isspace((
unsigned char) *s))
153 (isalnum((
unsigned char) *s) ||
164 in_quotes = !in_quotes;
174 (
errcode(ERRCODE_NAME_TOO_LONG),
175 errmsg(
"identifier too long"),
176 errdetail(
"Identifier must be less than %d characters.",
182 while (isspace((
unsigned char) *s))
198 for (src = s; *src; src++)
201 if (!isalnum((
unsigned char) *src) && *src !=
'_')
209 for (src = s; *src; src++)
261 if (strcmp(
name,
"group") != 0 && strcmp(
name,
"user") != 0)
263 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
264 errmsg(
"unrecognized key word: \"%s\"",
name),
265 errhint(
"ACL key word must be \"group\" or \"user\".")));
272 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
274 errhint(
"A name must follow the \"group\" or \"user\" key word.")));
279 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
280 errmsg(
"missing \"=\" sign")));
284 for (++s,
read = 0; isalpha((
unsigned char) *s) || *s ==
'*'; s++)
341 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
342 errmsg(
"invalid mode character: must be one of \"%s\"",
356 (
errcode(ERRCODE_UNDEFINED_OBJECT),
366 s =
getid(s + 1, name2, escontext);
369 if (name2[0] ==
'\0')
371 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
372 errmsg(
"a name must follow the \"/\" sign")));
376 (
errcode(ERRCODE_UNDEFINED_OBJECT),
377 errmsg(
"role \"%s\" does not exist", name2)));
383 (
errcode(ERRCODE_INVALID_GRANTOR),
384 errmsg(
"defaulting grantor to user ID %u",
385 BOOTSTRAP_SUPERUSERID)));
484 if (left_acl == NULL ||
ACL_NUM(left_acl) == 0)
486 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
493 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
498 result_acl =
aclcopy(left_acl);
503 for (
i = 0;
i < num;
i++, aip++)
510 result_acl = tmp_acl;
522 if (acl != NULL &&
ACL_NUM(acl) > 1)
537 if (left_acl == NULL ||
ACL_NUM(left_acl) == 0)
539 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
546 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
569 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
570 errmsg(
"ACL array contains wrong data type")));
573 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
574 errmsg(
"ACL arrays must be one-dimensional")));
577 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
578 errmsg(
"ACL arrays must not contain null values")));
593 Node *escontext = fcinfo->context;
602 while (isspace((
unsigned char) *s))
606 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
607 errmsg(
"extra garbage at the end of the ACL specification")));
629 out =
palloc(strlen(
"=/") +
690 return a1->ai_grantee ==
a2->ai_grantee &&
691 a1->ai_grantor ==
a2->ai_grantor;
704 if (
a1->ai_grantee >
a2->ai_grantee)
706 if (
a1->ai_grantee <
a2->ai_grantee)
708 if (
a1->ai_grantor >
a2->ai_grantor)
710 if (
a1->ai_grantor <
a2->ai_grantor)
712 if (
a1->ai_privs >
a2->ai_privs)
714 if (
a1->ai_privs <
a2->ai_privs)
729 result =
a1->ai_privs ==
a2->ai_privs &&
730 a1->ai_grantee ==
a2->ai_grantee &&
731 a1->ai_grantor ==
a2->ai_grantor;
846 elog(
ERROR,
"unrecognized object type: %d", (
int) objtype);
943 elog(
ERROR,
"unrecognized object type abbreviation: %c", objtypec);
998 for (dst = 0; dst < num; ++dst)
1005 memcpy(new_acl, old_acl,
ACL_SIZE(old_acl));
1015 memcpy(new_aip, old_aip, num *
sizeof(
AclItem));
1053 memmove(new_aip + dst,
1055 (num - dst - 1) *
sizeof(
AclItem));
1065 if ((old_goptions & ~new_goptions) != 0)
1069 (old_goptions & ~new_goptions),
1096 bool newpresent =
false;
1113 memcpy(new_aip, old_aip, num *
sizeof(
AclItem));
1114 for (dst = 0, dst_aip = new_aip; dst < num; dst++, dst_aip++)
1145 for (targ = 0, targ_aip = new_aip; targ < num; targ++, targ_aip++)
1151 for (src = targ + 1, src_aip = targ_aip + 1; src < num;
1166 new_aip[dst] = *targ_aip;
1214 memcpy(acl, old_acl,
ACL_SIZE(old_acl));
1220 for (
i = 0;
i < num;
i++)
1248 (
errcode(ERRCODE_INVALID_GRANT_OPERATION),
1249 errmsg(
"grant options cannot be granted back to your own grantor")));
1285 if (grantee == ownerId)
1289 still_has =
aclmask(acl, grantee, ownerId,
1299 for (
i = 0;
i < num;
i++)
1301 if (aip[
i].ai_grantor == grantee
1309 (
errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
1310 errmsg(
"dependent privileges exist"),
1311 errhint(
"Use CASCADE to revoke them too.")));
1386 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1396 for (
i = 0;
i < num;
i++)
1404 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1417 for (
i = 0;
i < num;
i++)
1429 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1474 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1484 for (
i = 0;
i < num;
i++)
1491 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1516 if (acl == NULL ||
ACL_NUM(acl) == 0)
1564 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1565 errmsg(
"aclinsert is no longer supported")));
1574 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1575 errmsg(
"aclremove is no longer supported")));
1592 for (
i = 0;
i < num; ++
i)
1611 static const priv_map any_priv_map[] = {
1665 for (chunk = priv_type; chunk; chunk = next_chunk)
1671 next_chunk = strchr(chunk,
',');
1673 *next_chunk++ =
'\0';
1676 while (*chunk && isspace((
unsigned char) *chunk))
1678 chunk_len = strlen(chunk);
1679 while (chunk_len > 0 && isspace((
unsigned char) chunk[chunk_len - 1]))
1681 chunk[chunk_len] =
'\0';
1684 for (this_priv = privileges; this_priv->
name; this_priv++)
1688 result |= this_priv->
value;
1692 if (!this_priv->
name)
1694 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1695 errmsg(
"unrecognized privilege type: \"%s\"", chunk)));
1719 return "REFERENCES";
1735 return "ALTER SYSTEM";
1739 elog(
ERROR,
"unrecognized aclright: %d", aclright);
1820 aidata = &aidat[
idx[0]];
1821 priv_bit = UINT64CONST(1) <<
idx[1];
1827 bool nulls[4] = {0};
1922 bool is_missing =
false;
1949 bool is_missing =
false;
1998 bool is_missing =
false;
2035 static const priv_map table_priv_map[] = {
2053 {
"RULE WITH GRANT OPTION", 0},
2092 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2093 errmsg(
"\"%s\" is not a sequence",
2122 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2123 errmsg(
"\"%s\" is not a sequence",
2146 bool is_missing =
false;
2151 if (relkind ==
'\0')
2153 else if (relkind != RELKIND_SEQUENCE)
2155 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2156 errmsg(
"\"%s\" is not a sequence",
2182 bool is_missing =
false;
2187 if (relkind ==
'\0')
2189 else if (relkind != RELKIND_SEQUENCE)
2191 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2192 errmsg(
"\"%s\" is not a sequence",
2222 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2223 errmsg(
"\"%s\" is not a sequence",
2245 bool is_missing =
false;
2249 if (relkind ==
'\0')
2251 else if (relkind != RELKIND_SEQUENCE)
2253 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2254 errmsg(
"\"%s\" is not a sequence",
2272 static const priv_map sequence_priv_map[] = {
2369 bool is_missing =
false;
2403 bool is_missing =
false;
2463 bool is_missing =
false;
2511 bool is_missing =
false;
2528 else if (is_missing)
2535 else if (is_missing)
2889 if (attributeForm->attisdropped)
2892 attnum = attributeForm->attnum;
2904 if (tablename != NULL)
2908 (
errcode(ERRCODE_UNDEFINED_COLUMN),
2909 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
2910 colname, tablename)));
2927 static const priv_map column_priv_map[] = {
3017 bool is_missing =
false;
3046 bool is_missing =
false;
3097 bool is_missing =
false;
3133 static const priv_map database_priv_map[] = {
3223 bool is_missing =
false;
3252 bool is_missing =
false;
3303 bool is_missing =
false;
3339 static const priv_map foreign_data_wrapper_priv_map[] = {
3423 bool is_missing =
false;
3452 bool is_missing =
false;
3503 bool is_missing =
false;
3535 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
3548 static const priv_map function_priv_map[] = {
3632 bool is_missing =
false;
3661 bool is_missing =
false;
3712 bool is_missing =
false;
3748 static const priv_map language_priv_map[] = {
3832 bool is_missing =
false;
3861 bool is_missing =
false;
3912 bool is_missing =
false;
3948 static const priv_map schema_priv_map[] = {
4034 bool is_missing =
false;
4063 bool is_missing =
false;
4114 bool is_missing =
false;
4150 static const priv_map server_priv_map[] = {
4234 bool is_missing =
false;
4263 bool is_missing =
false;
4314 bool is_missing =
false;
4350 static const priv_map tablespace_priv_map[] = {
4433 bool is_missing =
false;
4462 bool is_missing =
false;
4513 bool is_missing =
false;
4545 (
errcode(ERRCODE_UNDEFINED_OBJECT),
4558 static const priv_map type_priv_map[] = {
4647 static const priv_map parameter_priv_map[] = {
4825 static const priv_map role_priv_map[] = {
4908 if (cacheid == DATABASEOID &&
4942 Oid admin_of,
Oid *admin_role)
4947 List *new_cached_roles;
4951 if (admin_role != NULL)
4990 foreach(l, roles_list)
5003 Oid otherid = form->roleid;
5009 if (otherid == admin_of && form->admin_option &&
5011 *admin_role = memberid;
5033 ROLE_PG_DATABASE_OWNER);
5040 new_cached_roles =
list_copy(roles_list);
5127 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
5128 errmsg(
"must be able to SET ROLE \"%s\"",
5277 const Acl *acl,
Oid ownerId,
5293 *grantorId = ownerId;
5294 *grantOptions = needed_goptions;
5308 *grantorId = roleId;
5312 foreach(l, roles_list)
5319 if (otherprivs == needed_goptions)
5322 *grantorId = otherrole;
5323 *grantOptions = otherprivs;
5335 if (nnewrights > nrights)
5337 *grantorId = otherrole;
5338 *grantOptions = otherprivs;
5339 nrights = nnewrights;
5360 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5372 if (strcmp(
rolname,
"public") == 0)
5408 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5409 errmsg(
"role \"%s\" does not exist",
"public")));
5436 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5455 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5456 errmsg(
"role \"%s\" does not exist",
"public")));
5505 (
errcode(ERRCODE_RESERVED_NAME),
5506 errmsg(
"role name \"%s\" is reserved",
5511 (
errcode(ERRCODE_RESERVED_NAME),
5512 errmsg(
"role name \"%s\" is reserved",
Datum idx(PG_FUNCTION_ARGS)
Datum pg_has_role_id_id(PG_FUNCTION_ARGS)
Datum has_schema_privilege_id(PG_FUNCTION_ARGS)
Datum hash_aclitem(PG_FUNCTION_ARGS)
void initialize_acl(void)
Datum has_sequence_privilege_name(PG_FUNCTION_ARGS)
Datum has_table_privilege_id_id(PG_FUNCTION_ARGS)
Datum has_server_privilege_id(PG_FUNCTION_ARGS)
Acl * aclupdate(const Acl *old_acl, const AclItem *mod_aip, int modechg, Oid ownerId, DropBehavior behavior)
Datum has_tablespace_privilege_id_id(PG_FUNCTION_ARGS)
Datum has_column_privilege_id_id_attnum(PG_FUNCTION_ARGS)
Datum has_server_privilege_name_name(PG_FUNCTION_ARGS)
Datum aclinsert(PG_FUNCTION_ARGS)
static AclMode convert_function_priv_string(text *priv_type_text)
static const char * getid(const char *s, char *n, Node *escontext)
static const char * convert_aclright_to_string(int aclright)
bool is_admin_of_role(Oid member, Oid role)
Datum has_column_privilege_id_name(PG_FUNCTION_ARGS)
static bool aclitem_match(const AclItem *a1, const AclItem *a2)
Datum pg_has_role_name_name(PG_FUNCTION_ARGS)
Datum has_language_privilege_name_name(PG_FUNCTION_ARGS)
Datum has_schema_privilege_name_name(PG_FUNCTION_ARGS)
Datum aclitem_eq(PG_FUNCTION_ARGS)
Datum has_tablespace_privilege_name_id(PG_FUNCTION_ARGS)
Datum makeaclitem(PG_FUNCTION_ARGS)
Datum has_table_privilege_id_name(PG_FUNCTION_ARGS)
Datum has_server_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_column_privilege_name_id_attnum(PG_FUNCTION_ARGS)
Datum has_language_privilege_id_name(PG_FUNCTION_ARGS)
static int column_privilege_check(Oid tableoid, AttrNumber attnum, Oid roleid, AclMode mode)
static Oid convert_type_name(text *typename)
char * get_rolespec_name(const RoleSpec *role)
Oid select_best_admin(Oid member, Oid role)
Datum aclexplode(PG_FUNCTION_ARGS)
static Oid convert_database_name(text *databasename)
Datum aclitemout(PG_FUNCTION_ARGS)
Oid get_role_oid_or_public(const char *rolname)
Datum has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS)
bool aclequal(const Acl *left_acl, const Acl *right_acl)
Datum hash_aclitem_extended(PG_FUNCTION_ARGS)
static void check_acl(const Acl *acl)
Datum has_parameter_privilege_name_name(PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS)
Datum has_database_privilege_name(PG_FUNCTION_ARGS)
static uint32 cached_db_hash
Datum has_type_privilege_name_name(PG_FUNCTION_ARGS)
Datum has_column_privilege_name_name_name(PG_FUNCTION_ARGS)
Datum pg_has_role_name(PG_FUNCTION_ARGS)
Datum has_sequence_privilege_id(PG_FUNCTION_ARGS)
static AclMode convert_type_priv_string(text *priv_type_text)
Datum has_tablespace_privilege_name(PG_FUNCTION_ARGS)
static AclMode convert_table_priv_string(text *priv_type_text)
static AclMode convert_server_priv_string(text *priv_type_text)
Datum has_table_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_name_name(PG_FUNCTION_ARGS)
Datum has_tablespace_privilege_id_name(PG_FUNCTION_ARGS)
static Acl * recursive_revoke(Acl *acl, Oid grantee, AclMode revoke_privs, Oid ownerId, DropBehavior behavior)
static void RoleMembershipCacheCallback(Datum arg, int cacheid, uint32 hashvalue)
Datum has_database_privilege_name_id(PG_FUNCTION_ARGS)
static Oid convert_schema_name(text *schemaname)
Datum has_column_privilege_name_name(PG_FUNCTION_ARGS)
static void putid(char *p, const char *s)
Datum has_schema_privilege_id_name(PG_FUNCTION_ARGS)
static void check_circularity(const Acl *old_acl, const AclItem *mod_aip, Oid ownerId)
static bool has_param_priv_byname(Oid roleid, const text *parameter, AclMode priv)
bool is_member_of_role(Oid member, Oid role)
Datum has_sequence_privilege_id_name(PG_FUNCTION_ARGS)
Datum has_database_privilege_id_name(PG_FUNCTION_ARGS)
static Oid convert_foreign_data_wrapper_name(text *fdwname)
Datum has_language_privilege_id(PG_FUNCTION_ARGS)
static AclMode convert_database_priv_string(text *priv_type_text)
Datum has_foreign_data_wrapper_privilege_name(PG_FUNCTION_ARGS)
Datum has_column_privilege_name_attnum(PG_FUNCTION_ARGS)
Datum has_column_privilege_id_attnum(PG_FUNCTION_ARGS)
Datum has_type_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_any_column_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_server_privilege_id_name(PG_FUNCTION_ARGS)
Datum has_language_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_foreign_data_wrapper_privilege_id_name(PG_FUNCTION_ARGS)
Datum has_schema_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_function_privilege_name_name(PG_FUNCTION_ARGS)
void select_best_grantor(Oid roleId, AclMode privileges, const Acl *acl, Oid ownerId, Oid *grantorId, AclMode *grantOptions)
Datum has_any_column_privilege_name_name(PG_FUNCTION_ARGS)
bool is_member_of_role_nosuper(Oid member, Oid role)
Datum has_sequence_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_schema_privilege_name(PG_FUNCTION_ARGS)
Datum acldefault_sql(PG_FUNCTION_ARGS)
bool has_privs_of_role(Oid member, Oid role)
static Oid convert_language_name(text *languagename)
Datum has_language_privilege_id_id(PG_FUNCTION_ARGS)
static AclMode convert_any_priv_string(text *priv_type_text, const priv_map *privileges)
Datum has_database_privilege_id_id(PG_FUNCTION_ARGS)
Datum has_function_privilege_name(PG_FUNCTION_ARGS)
int aclmembers(const Acl *acl, Oid **roleids)
Datum has_language_privilege_name(PG_FUNCTION_ARGS)
Acl * aclconcat(const Acl *left_acl, const Acl *right_acl)
Acl * aclcopy(const Acl *orig_acl)
Datum has_server_privilege_name(PG_FUNCTION_ARGS)
bool member_can_set_role(Oid member, Oid role)
Datum aclremove(PG_FUNCTION_ARGS)
Datum has_function_privilege_id(PG_FUNCTION_ARGS)
void aclitemsort(Acl *acl)
Datum has_table_privilege_id(PG_FUNCTION_ARGS)
Datum has_function_privilege_id_id(PG_FUNCTION_ARGS)
AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId, AclMode mask, AclMaskHow how)
static Oid convert_server_name(text *servername)
Acl * acldefault(ObjectType objtype, Oid ownerId)
static Oid convert_tablespace_name(text *tablespacename)
Acl * make_empty_acl(void)
Datum has_column_privilege_name_name_attnum(PG_FUNCTION_ARGS)
static AclMode convert_parameter_priv_string(text *priv_text)
static Oid convert_table_name(text *tablename)
Datum has_column_privilege_name_id_name(PG_FUNCTION_ARGS)
static int count_one_bits(AclMode mask)
static AclMode convert_tablespace_priv_string(text *priv_type_text)
static AclMode convert_language_priv_string(text *priv_type_text)
Datum aclitemin(PG_FUNCTION_ARGS)
static AclMode convert_sequence_priv_string(text *priv_type_text)
Datum pg_has_role_id(PG_FUNCTION_ARGS)
Datum has_parameter_privilege_id_name(PG_FUNCTION_ARGS)
Acl * aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId)
static Acl * allocacl(int n)
static AttrNumber convert_column_name(Oid tableoid, text *column)
static AclMode convert_role_priv_string(text *priv_type_text)
Oid get_role_oid(const char *rolname, bool missing_ok)
Datum has_tablespace_privilege_name_name(PG_FUNCTION_ARGS)
Datum has_parameter_privilege_name(PG_FUNCTION_ARGS)
Datum has_any_column_privilege_name(PG_FUNCTION_ARGS)
Datum has_sequence_privilege_name_name(PG_FUNCTION_ARGS)
Datum has_function_privilege_name_id(PG_FUNCTION_ARGS)
Datum has_type_privilege_id_id(PG_FUNCTION_ARGS)
Datum has_server_privilege_id_id(PG_FUNCTION_ARGS)
static AclResult pg_role_aclcheck(Oid role_oid, Oid roleid, AclMode mode)
Datum has_function_privilege_id_name(PG_FUNCTION_ARGS)
Datum has_table_privilege_name(PG_FUNCTION_ARGS)
Datum has_type_privilege_id_name(PG_FUNCTION_ARGS)
Datum has_column_privilege_id_name_attnum(PG_FUNCTION_ARGS)
void check_can_set_role(Oid member, Oid role)
static const char * aclparse(const char *s, AclItem *aip, Node *escontext)
void check_rolespec_name(const RoleSpec *role, const char *detail_msg)
Datum has_type_privilege_name(PG_FUNCTION_ARGS)
static List * cached_roles[]
static AclMode aclmask_direct(const Acl *acl, Oid roleid, Oid ownerId, AclMode mask, AclMaskHow how)
Datum has_tablespace_privilege_id(PG_FUNCTION_ARGS)
Datum pg_has_role_name_id(PG_FUNCTION_ARGS)
Datum aclcontains(PG_FUNCTION_ARGS)
static Oid convert_function_name(text *functionname)
Datum has_column_privilege_id_name_name(PG_FUNCTION_ARGS)
Datum has_schema_privilege_id_id(PG_FUNCTION_ARGS)
Oid get_rolespec_oid(const RoleSpec *role, bool missing_ok)
Datum has_any_column_privilege_id_name(PG_FUNCTION_ARGS)
Datum has_database_privilege_name_name(PG_FUNCTION_ARGS)
Datum has_column_privilege_id_id_name(PG_FUNCTION_ARGS)
static AclMode convert_schema_priv_string(text *priv_type_text)
static List * roles_is_member_of(Oid roleid, enum RoleRecurseType type, Oid admin_of, Oid *admin_role)
Datum has_table_privilege_name_name(PG_FUNCTION_ARGS)
Datum has_any_column_privilege_id_id(PG_FUNCTION_ARGS)
static AclMode convert_foreign_data_wrapper_priv_string(text *priv_type_text)
Datum has_database_privilege_id(PG_FUNCTION_ARGS)
static int aclitemComparator(const void *arg1, const void *arg2)
Datum has_type_privilege_id(PG_FUNCTION_ARGS)
Datum has_any_column_privilege_id(PG_FUNCTION_ARGS)
Datum pg_has_role_id_name(PG_FUNCTION_ARGS)
Acl * aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId)
Datum has_sequence_privilege_id_id(PG_FUNCTION_ARGS)
HeapTuple get_rolespec_tuple(const RoleSpec *role)
static AclMode convert_column_priv_string(text *priv_type_text)
#define PG_RETURN_ACLITEM_P(x)
#define ACL_ALL_RIGHTS_STR
#define ACL_REFERENCES_CHR
#define ACLITEM_ALL_GOPTION_BITS
#define PG_GETARG_ACLITEM_P(n)
#define ACL_ALL_RIGHTS_FOREIGN_SERVER
#define ACL_ALL_RIGHTS_TABLESPACE
#define ACLITEM_GET_PRIVS(item)
#define ACL_ALL_RIGHTS_PARAMETER_ACL
#define ACL_ALL_RIGHTS_SCHEMA
#define ACL_ALL_RIGHTS_SEQUENCE
#define ACL_ALL_RIGHTS_DATABASE
#define ACL_OPTION_TO_PRIVS(privs)
#define ACL_ALL_RIGHTS_FUNCTION
#define ACL_ALL_RIGHTS_LANGUAGE
#define ACL_ALL_RIGHTS_TYPE
#define ACL_ALTER_SYSTEM_CHR
#define ACL_ALL_RIGHTS_FDW
#define ACLITEM_SET_PRIVS_GOPTIONS(item, privs, goptions)
#define PG_GETARG_ACL_P(n)
#define ACLITEM_GET_GOPTIONS(item)
#define ACLITEM_GET_RIGHTS(item)
#define ACL_ALL_RIGHTS_RELATION
#define ACL_ALL_RIGHTS_LARGEOBJECT
#define PG_RETURN_ACL_P(x)
#define ACL_CREATE_TEMP_CHR
#define ACL_GRANT_OPTION_FOR(privs)
#define ACLITEM_SET_RIGHTS(item, rights)
AclResult object_aclcheck_ext(Oid classid, Oid objectid, Oid roleid, AclMode mode, bool *is_missing)
AclResult pg_class_aclcheck_ext(Oid table_oid, Oid roleid, AclMode mode, bool *is_missing)
AclResult pg_attribute_aclcheck_all_ext(Oid table_oid, Oid roleid, AclMode mode, AclMaskHow how, bool *is_missing)
AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode, AclMaskHow how)
AclResult pg_parameter_aclcheck(const char *name, Oid roleid, AclMode mode)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
AclResult pg_attribute_aclcheck_ext(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mode, bool *is_missing)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
#define InvalidAttrNumber
Oid get_tablespace_oid(const char *tablespacename, bool missing_ok)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define PointerIsValid(pointer)
#define OidIsValid(objectId)
bool IsReservedName(const char *name)
Oid get_database_oid(const char *dbname, bool missing_ok)
int errdetail_internal(const char *fmt,...)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
#define PG_RETURN_UINT32(x)
#define PG_GETARG_TEXT_PP(n)
#define PG_GETARG_CHAR(n)
#define PG_RETURN_CSTRING(x)
#define DirectFunctionCall1(func, arg1)
#define PG_GETARG_CSTRING(n)
#define PG_GETARG_INT64(n)
#define PG_GETARG_NAME(n)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_BOOL(x)
#define PG_GETARG_INT16(n)
Oid get_foreign_server_oid(const char *servername, bool missing_ok)
Oid get_foreign_data_wrapper_oid(const char *fdwname, bool missing_ok)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define SRF_RETURN_DONE(_funcctx)
static Datum hash_uint32_extended(uint32 k, uint64 seed)
static const FormData_pg_attribute a1
static const FormData_pg_attribute a2
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
#define HeapTupleIsValid(tuple)
void CacheRegisterSyscacheCallback(int cacheid, SyscacheCallbackFunction func, Datum arg)
Assert(fmt[strlen(fmt) - 1] !='\n')
List * list_copy(const List *oldlist)
void list_free(List *list)
bool list_member_oid(const List *list, Oid datum)
List * list_append_unique_oid(List *list, Oid datum)
char get_rel_relkind(Oid relid)
char * get_rel_name(Oid relid)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext TopMemoryContext
void * palloc0(Size size)
#define IsBootstrapProcessingMode()
char * GetUserNameFromId(Oid roleid, bool noerr)
Oid GetSessionUserId(void)
Oid get_namespace_oid(const char *nspname, bool missing_ok)
RangeVar * makeRangeVarFromNameList(const List *names)
#define RangeVarGetRelid(relation, lockmode, missing_ok)
int oid_cmp(const void *p1, const void *p2)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
FormData_pg_attribute * Form_pg_attribute
FormData_pg_auth_members * Form_pg_auth_members
FormData_pg_authid * Form_pg_authid
static PgChecksumMode mode
FormData_pg_database * Form_pg_database
#define list_make1_oid(x1)
int pg_strcasecmp(const char *s1, const char *s2)
#define qsort(a, b, c, d)
static Oid DatumGetObjectId(Datum X)
static Datum UInt64GetDatum(uint64 X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
Oid get_language_oid(const char *langname, bool missing_ok)
static size_t qunique(void *array, size_t elements, size_t width, int(*compare)(const void *, const void *))
Datum regtypein(PG_FUNCTION_ARGS)
Datum regprocedurein(PG_FUNCTION_ARGS)
static pg_noinline void Size size
MemoryContext multi_call_memory_ctx
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
bool superuser_arg(Oid roleid)
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
HeapTuple SearchSysCache2(int cacheId, Datum key1, Datum key2)
#define ReleaseSysCacheList(x)
#define SearchSysCacheList1(cacheId, key1)
#define GetSysCacheHashValue1(cacheId, key1)
#define GetSysCacheOid1(cacheId, oidcol, key1)
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
#define SET_VARSIZE(PTR, len)
List * textToQualifiedNameList(text *textval)
char * text_to_cstring(const text *t)