91#define ROLES_LIST_BLOOM_THRESHOLD 1024
93static const char *
getid(
const char *s,
char *n,
Node *escontext);
94static void putid(
char *p,
const char *s);
156 bool in_quotes =
false;
160 while (isspace((
unsigned char) *s))
165 (isalnum((
unsigned char) *s) ||
176 in_quotes = !in_quotes;
186 (
errcode(ERRCODE_NAME_TOO_LONG),
187 errmsg(
"identifier too long"),
188 errdetail(
"Identifier must be less than %d characters.",
194 while (isspace((
unsigned char) *s))
210 for (src = s; *src; src++)
213 if (!isalnum((
unsigned char) *src) && *src !=
'_')
221 for (src = s; *src; src++)
273 if (strcmp(
name,
"group") != 0 && strcmp(
name,
"user") != 0)
275 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
276 errmsg(
"unrecognized key word: \"%s\"",
name),
277 errhint(
"ACL key word must be \"group\" or \"user\".")));
284 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
286 errhint(
"A name must follow the \"group\" or \"user\" key word.")));
291 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
292 errmsg(
"missing \"=\" sign")));
296 for (++s,
read = 0; isalpha((
unsigned char) *s) || *s ==
'*'; s++)
350 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
351 errmsg(
"invalid mode character: must be one of \"%s\"",
365 (
errcode(ERRCODE_UNDEFINED_OBJECT),
375 s =
getid(s + 1, name2, escontext);
378 if (name2[0] ==
'\0')
380 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
381 errmsg(
"a name must follow the \"/\" sign")));
385 (
errcode(ERRCODE_UNDEFINED_OBJECT),
386 errmsg(
"role \"%s\" does not exist", name2)));
392 (
errcode(ERRCODE_INVALID_GRANTOR),
393 errmsg(
"defaulting grantor to user ID %u",
394 BOOTSTRAP_SUPERUSERID)));
493 if (left_acl == NULL ||
ACL_NUM(left_acl) == 0)
495 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
502 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
507 result_acl =
aclcopy(left_acl);
512 for (
i = 0;
i < num;
i++, aip++)
519 result_acl = tmp_acl;
531 if (acl != NULL &&
ACL_NUM(acl) > 1)
546 if (left_acl == NULL ||
ACL_NUM(left_acl) == 0)
548 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
555 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
578 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
579 errmsg(
"ACL array contains wrong data type")));
582 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
583 errmsg(
"ACL arrays must be one-dimensional")));
586 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
587 errmsg(
"ACL arrays must not contain null values")));
602 Node *escontext = fcinfo->context;
611 while (isspace((
unsigned char) *s))
615 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
616 errmsg(
"extra garbage at the end of the ACL specification")));
638 out =
palloc(strlen(
"=/") +
699 return a1->ai_grantee ==
a2->ai_grantee &&
700 a1->ai_grantor ==
a2->ai_grantor;
713 if (
a1->ai_grantee >
a2->ai_grantee)
715 if (
a1->ai_grantee <
a2->ai_grantee)
717 if (
a1->ai_grantor >
a2->ai_grantor)
719 if (
a1->ai_grantor <
a2->ai_grantor)
721 if (
a1->ai_privs >
a2->ai_privs)
723 if (
a1->ai_privs <
a2->ai_privs)
738 result =
a1->ai_privs ==
a2->ai_privs &&
739 a1->ai_grantee ==
a2->ai_grantee &&
740 a1->ai_grantor ==
a2->ai_grantor;
855 elog(
ERROR,
"unrecognized object type: %d", (
int) objtype);
952 elog(
ERROR,
"unrecognized object type abbreviation: %c", objtypec);
1007 for (dst = 0; dst < num; ++dst)
1014 memcpy(new_acl, old_acl,
ACL_SIZE(old_acl));
1024 memcpy(new_aip, old_aip, num *
sizeof(
AclItem));
1062 memmove(new_aip + dst,
1064 (num - dst - 1) *
sizeof(
AclItem));
1074 if ((old_goptions & ~new_goptions) != 0)
1078 (old_goptions & ~new_goptions),
1111 bool newpresent =
false;
1128 memcpy(new_aip, old_aip, num *
sizeof(
AclItem));
1129 for (dst = 0, dst_aip = new_aip; dst < num; dst++, dst_aip++)
1160 for (targ = 0, targ_aip = new_aip; targ < num; targ++, targ_aip++)
1166 for (src = targ + 1, src_aip = targ_aip + 1; src < num;
1181 new_aip[dst] = *targ_aip;
1229 memcpy(acl, old_acl,
ACL_SIZE(old_acl));
1235 for (
i = 0;
i < num;
i++)
1263 (
errcode(ERRCODE_INVALID_GRANT_OPERATION),
1264 errmsg(
"grant options cannot be granted back to your own grantor")));
1300 if (grantee == ownerId)
1304 still_has =
aclmask(acl, grantee, ownerId,
1307 revoke_privs &= ~ACL_OPTION_TO_PRIVS(still_has);
1314 for (
i = 0;
i < num;
i++)
1316 if (aip[
i].ai_grantor == grantee
1324 (
errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
1325 errmsg(
"dependent privileges exist"),
1326 errhint(
"Use CASCADE to revoke them too.")));
1401 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1411 for (
i = 0;
i < num;
i++)
1419 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1432 for (
i = 0;
i < num;
i++)
1444 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1489 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1499 for (
i = 0;
i < num;
i++)
1506 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1531 if (acl == NULL ||
ACL_NUM(acl) == 0)
1579 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1580 errmsg(
"aclinsert is no longer supported")));
1589 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1590 errmsg(
"aclremove is no longer supported")));
1607 for (
i = 0;
i < num; ++
i)
1626 static const priv_map any_priv_map[] = {
1679 for (chunk = priv_type; chunk; chunk = next_chunk)
1685 next_chunk = strchr(chunk,
',');
1687 *next_chunk++ =
'\0';
1690 while (*chunk && isspace((
unsigned char) *chunk))
1692 chunk_len = strlen(chunk);
1693 while (chunk_len > 0 && isspace((
unsigned char) chunk[chunk_len - 1]))
1695 chunk[chunk_len] =
'\0';
1698 for (this_priv = privileges; this_priv->
name; this_priv++)
1702 result |= this_priv->
value;
1706 if (!this_priv->
name)
1708 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1709 errmsg(
"unrecognized privilege type: \"%s\"", chunk)));
1733 return "REFERENCES";
1749 return "ALTER SYSTEM";
1753 elog(
ERROR,
"unrecognized aclright: %d", aclright);
1834 aidata = &aidat[
idx[0]];
1841 bool nulls[4] = {0};
1936 bool is_missing =
false;
1963 bool is_missing =
false;
2012 bool is_missing =
false;
2049 static const priv_map table_priv_map[] = {
2104 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2105 errmsg(
"\"%s\" is not a sequence",
2134 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2135 errmsg(
"\"%s\" is not a sequence",
2158 bool is_missing =
false;
2163 if (relkind ==
'\0')
2165 else if (relkind != RELKIND_SEQUENCE)
2167 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2168 errmsg(
"\"%s\" is not a sequence",
2194 bool is_missing =
false;
2199 if (relkind ==
'\0')
2201 else if (relkind != RELKIND_SEQUENCE)
2203 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2204 errmsg(
"\"%s\" is not a sequence",
2234 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2235 errmsg(
"\"%s\" is not a sequence",
2257 bool is_missing =
false;
2261 if (relkind ==
'\0')
2263 else if (relkind != RELKIND_SEQUENCE)
2265 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2266 errmsg(
"\"%s\" is not a sequence",
2284 static const priv_map sequence_priv_map[] = {
2381 bool is_missing =
false;
2415 bool is_missing =
false;
2475 bool is_missing =
false;
2523 bool is_missing =
false;
2540 else if (is_missing)
2547 else if (is_missing)
2901 if (attributeForm->attisdropped)
2904 attnum = attributeForm->attnum;
2916 if (tablename != NULL)
2920 (
errcode(ERRCODE_UNDEFINED_COLUMN),
2921 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
2922 colname, tablename)));
2939 static const priv_map column_priv_map[] = {
3029 bool is_missing =
false;
3058 bool is_missing =
false;
3109 bool is_missing =
false;
3145 static const priv_map database_priv_map[] = {
3235 bool is_missing =
false;
3264 bool is_missing =
false;
3315 bool is_missing =
false;
3351 static const priv_map foreign_data_wrapper_priv_map[] = {
3435 bool is_missing =
false;
3464 bool is_missing =
false;
3515 bool is_missing =
false;
3547 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
3560 static const priv_map function_priv_map[] = {
3644 bool is_missing =
false;
3673 bool is_missing =
false;
3724 bool is_missing =
false;
3760 static const priv_map language_priv_map[] = {
3844 bool is_missing =
false;
3873 bool is_missing =
false;
3924 bool is_missing =
false;
3960 static const priv_map schema_priv_map[] = {
4046 bool is_missing =
false;
4075 bool is_missing =
false;
4126 bool is_missing =
false;
4162 static const priv_map server_priv_map[] = {
4246 bool is_missing =
false;
4275 bool is_missing =
false;
4326 bool is_missing =
false;
4362 static const priv_map tablespace_priv_map[] = {
4445 bool is_missing =
false;
4474 bool is_missing =
false;
4525 bool is_missing =
false;
4557 (
errcode(ERRCODE_UNDEFINED_OBJECT),
4570 static const priv_map type_priv_map[] = {
4659 static const priv_map parameter_priv_map[] = {
4699 Assert(is_missing != NULL);
4727 bool is_missing =
false;
4752 bool is_missing =
false;
4776 bool is_missing =
false;
4795 static const priv_map largeobject_priv_map[] = {
4973 static const priv_map role_priv_map[] = {
5056 if (cacheid == DATABASEOID &&
5078 unsigned char *roleptr = (
unsigned char *) &role;
5137 Oid admin_of,
Oid *admin_role)
5142 List *new_cached_roles;
5147 if (admin_role != NULL)
5186 foreach(l, roles_list)
5199 Oid otherid = form->roleid;
5205 if (otherid == admin_of && form->admin_option &&
5207 *admin_role = memberid;
5229 ROLE_PG_DATABASE_OWNER);
5242 new_cached_roles =
list_copy(roles_list);
5329 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
5330 errmsg(
"must be able to SET ROLE \"%s\"",
5461 const Acl *acl,
Oid ownerId,
5477 *grantorId = ownerId;
5478 *grantOptions = needed_goptions;
5492 *grantorId = roleId;
5496 foreach(l, roles_list)
5503 if (otherprivs == needed_goptions)
5506 *grantorId = otherrole;
5507 *grantOptions = otherprivs;
5519 if (nnewrights > nrights)
5521 *grantorId = otherrole;
5522 *grantOptions = otherprivs;
5523 nrights = nnewrights;
5544 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5556 if (strcmp(
rolname,
"public") == 0)
5592 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5593 errmsg(
"role \"%s\" does not exist",
"public")));
5620 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5639 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5640 errmsg(
"role \"%s\" does not exist",
"public")));
5689 (
errcode(ERRCODE_RESERVED_NAME),
5690 errmsg(
"role name \"%s\" is reserved",
5695 (
errcode(ERRCODE_RESERVED_NAME),
5696 errmsg(
"role name \"%s\" is reserved",
Datum idx(PG_FUNCTION_ARGS)
static List * roles_is_member_of(Oid roleid, enum RoleRecurseType type, Oid admin_of, Oid *admin_role)
Datum pg_has_role_id_id(PG_FUNCTION_ARGS)
Datum has_schema_privilege_id(PG_FUNCTION_ARGS)
Datum has_largeobject_privilege_id_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)
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)
Datum has_largeobject_privilege_name_id(PG_FUNCTION_ARGS)
static const char * getid(const char *s, char *n, Node *escontext)
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)
Acl * aclconcat(const Acl *left_acl, const Acl *right_acl)
Datum has_schema_privilege_name_name(PG_FUNCTION_ARGS)
Acl * aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId)
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)
Oid select_best_admin(Oid member, Oid role)
Datum aclexplode(PG_FUNCTION_ARGS)
static Oid convert_database_name(text *databasename)
Acl * acldefault(ObjectType objtype, Oid ownerId)
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)
#define ROLES_LIST_BLOOM_THRESHOLD
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_largeobject_priv_string(text *priv_text)
static List * roles_list_append(List *roles_list, bloom_filter **bf, Oid role)
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)
Acl * aclupdate(const Acl *old_acl, const AclItem *mod_aip, int modechg, Oid ownerId, DropBehavior behavior)
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)
Acl * make_empty_acl(void)
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 * aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId)
Datum has_server_privilege_name(PG_FUNCTION_ARGS)
bool member_can_set_role(Oid member, Oid role)
Datum aclremove(PG_FUNCTION_ARGS)
static const char * convert_aclright_to_string(int aclright)
Acl * aclcopy(const Acl *orig_acl)
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)
static Oid convert_tablespace_name(text *tablespacename)
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 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)
static Acl * allocacl(int n)
static AttrNumber convert_column_name(Oid tableoid, text *column)
static AclMode convert_role_priv_string(text *priv_type_text)
static bool has_lo_priv_byid(Oid roleid, Oid lobjId, AclMode priv, bool *is_missing)
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)
char * get_rolespec_name(const RoleSpec *role)
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_largeobject_privilege_id(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)
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)
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_largeobject_aclcheck_snapshot(Oid lobj_oid, Oid roleid, AclMode mode, Snapshot snapshot)
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)
void bloom_free(bloom_filter *filter)
bloom_filter * bloom_create(int64 total_elems, int bloom_work_mem, uint64 seed)
bool bloom_lacks_element(bloom_filter *filter, unsigned char *elem, size_t len)
void bloom_add_element(bloom_filter *filter, unsigned char *elem, size_t len)
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)
Assert(PointerIsAligned(start, uint64))
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)
static void * GETSTRUCT(const HeapTupleData *tuple)
bool lo_compat_privileges
void CacheRegisterSyscacheCallback(int cacheid, SyscacheCallbackFunction func, Datum arg)
List * list_copy(const List *oldlist)
List * lappend_oid(List *list, Oid datum)
void list_free(List *list)
bool list_member_oid(const List *list, Oid datum)
char * get_rel_name(Oid relid)
char get_rel_relkind(Oid relid)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext TopMemoryContext
#define IsBootstrapProcessingMode()
Oid GetSessionUserId(void)
char * GetUserNameFromId(Oid roleid, bool noerr)
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
int pg_popcount64(uint64 word)
static PgChecksumMode mode
FormData_pg_database * Form_pg_database
bool LargeObjectExistsWithSnapshot(Oid loid, Snapshot snapshot)
static int list_length(const List *l)
#define list_make1_oid(x1)
#define foreach_oid(var, lst)
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)
Snapshot GetActiveSnapshot(void)
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)
char * text_to_cstring(const text *t)
List * textToQualifiedNameList(text *textval)