88 #define ROLES_LIST_BLOOM_THRESHOLD 1024
90 static const char *
getid(
const char *s,
char *n,
Node *escontext);
91 static void putid(
char *p,
const char *s);
152 bool in_quotes =
false;
156 while (isspace((
unsigned char) *s))
161 (isalnum((
unsigned char) *s) ||
172 in_quotes = !in_quotes;
182 (
errcode(ERRCODE_NAME_TOO_LONG),
183 errmsg(
"identifier too long"),
184 errdetail(
"Identifier must be less than %d characters.",
190 while (isspace((
unsigned char) *s))
206 for (src = s; *src; src++)
209 if (!isalnum((
unsigned char) *src) && *src !=
'_')
217 for (src = s; *src; src++)
269 if (strcmp(
name,
"group") != 0 && strcmp(
name,
"user") != 0)
271 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
272 errmsg(
"unrecognized key word: \"%s\"",
name),
273 errhint(
"ACL key word must be \"group\" or \"user\".")));
280 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
282 errhint(
"A name must follow the \"group\" or \"user\" key word.")));
287 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
288 errmsg(
"missing \"=\" sign")));
292 for (++s,
read = 0; isalpha((
unsigned char) *s) || *s ==
'*'; s++)
349 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
350 errmsg(
"invalid mode character: must be one of \"%s\"",
364 (
errcode(ERRCODE_UNDEFINED_OBJECT),
374 s =
getid(s + 1, name2, escontext);
377 if (name2[0] ==
'\0')
379 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
380 errmsg(
"a name must follow the \"/\" sign")));
384 (
errcode(ERRCODE_UNDEFINED_OBJECT),
385 errmsg(
"role \"%s\" does not exist", name2)));
391 (
errcode(ERRCODE_INVALID_GRANTOR),
392 errmsg(
"defaulting grantor to user ID %u",
393 BOOTSTRAP_SUPERUSERID)));
492 if (left_acl == NULL ||
ACL_NUM(left_acl) == 0)
494 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
501 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
506 result_acl =
aclcopy(left_acl);
511 for (
i = 0;
i < num;
i++, aip++)
518 result_acl = tmp_acl;
530 if (acl != NULL &&
ACL_NUM(acl) > 1)
545 if (left_acl == NULL ||
ACL_NUM(left_acl) == 0)
547 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
554 if (right_acl == NULL ||
ACL_NUM(right_acl) == 0)
577 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
578 errmsg(
"ACL array contains wrong data type")));
581 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
582 errmsg(
"ACL arrays must be one-dimensional")));
585 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
586 errmsg(
"ACL arrays must not contain null values")));
601 Node *escontext = fcinfo->context;
610 while (isspace((
unsigned char) *s))
614 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
615 errmsg(
"extra garbage at the end of the ACL specification")));
637 out =
palloc(strlen(
"=/") +
698 return a1->ai_grantee ==
a2->ai_grantee &&
699 a1->ai_grantor ==
a2->ai_grantor;
712 if (
a1->ai_grantee >
a2->ai_grantee)
714 if (
a1->ai_grantee <
a2->ai_grantee)
716 if (
a1->ai_grantor >
a2->ai_grantor)
718 if (
a1->ai_grantor <
a2->ai_grantor)
720 if (
a1->ai_privs >
a2->ai_privs)
722 if (
a1->ai_privs <
a2->ai_privs)
737 result =
a1->ai_privs ==
a2->ai_privs &&
738 a1->ai_grantee ==
a2->ai_grantee &&
739 a1->ai_grantor ==
a2->ai_grantor;
854 elog(
ERROR,
"unrecognized object type: %d", (
int) objtype);
951 elog(
ERROR,
"unrecognized object type abbreviation: %c", objtypec);
1006 for (dst = 0; dst < num; ++dst)
1013 memcpy(new_acl, old_acl,
ACL_SIZE(old_acl));
1023 memcpy(new_aip, old_aip, num *
sizeof(
AclItem));
1061 memmove(new_aip + dst,
1063 (num - dst - 1) *
sizeof(
AclItem));
1073 if ((old_goptions & ~new_goptions) != 0)
1077 (old_goptions & ~new_goptions),
1104 bool newpresent =
false;
1121 memcpy(new_aip, old_aip, num *
sizeof(
AclItem));
1122 for (dst = 0, dst_aip = new_aip; dst < num; dst++, dst_aip++)
1153 for (targ = 0, targ_aip = new_aip; targ < num; targ++, targ_aip++)
1159 for (src = targ + 1, src_aip = targ_aip + 1; src < num;
1174 new_aip[dst] = *targ_aip;
1222 memcpy(acl, old_acl,
ACL_SIZE(old_acl));
1228 for (
i = 0;
i < num;
i++)
1256 (
errcode(ERRCODE_INVALID_GRANT_OPERATION),
1257 errmsg(
"grant options cannot be granted back to your own grantor")));
1293 if (grantee == ownerId)
1297 still_has =
aclmask(acl, grantee, ownerId,
1307 for (
i = 0;
i < num;
i++)
1309 if (aip[
i].ai_grantor == grantee
1317 (
errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
1318 errmsg(
"dependent privileges exist"),
1319 errhint(
"Use CASCADE to revoke them too.")));
1394 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1404 for (
i = 0;
i < num;
i++)
1412 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1425 for (
i = 0;
i < num;
i++)
1437 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1482 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1492 for (
i = 0;
i < num;
i++)
1499 if ((how ==
ACLMASK_ALL) ? (result == mask) : (result != 0))
1524 if (acl == NULL ||
ACL_NUM(acl) == 0)
1572 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1573 errmsg(
"aclinsert is no longer supported")));
1582 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1583 errmsg(
"aclremove is no longer supported")));
1600 for (
i = 0;
i < num; ++
i)
1619 static const priv_map any_priv_map[] = {
1673 for (chunk = priv_type; chunk; chunk = next_chunk)
1679 next_chunk = strchr(chunk,
',');
1681 *next_chunk++ =
'\0';
1684 while (*chunk && isspace((
unsigned char) *chunk))
1686 chunk_len = strlen(chunk);
1687 while (chunk_len > 0 && isspace((
unsigned char) chunk[chunk_len - 1]))
1689 chunk[chunk_len] =
'\0';
1692 for (this_priv = privileges; this_priv->
name; this_priv++)
1696 result |= this_priv->
value;
1700 if (!this_priv->
name)
1702 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1703 errmsg(
"unrecognized privilege type: \"%s\"", chunk)));
1727 return "REFERENCES";
1743 return "ALTER SYSTEM";
1747 elog(
ERROR,
"unrecognized aclright: %d", aclright);
1828 aidata = &aidat[
idx[0]];
1829 priv_bit = UINT64CONST(1) <<
idx[1];
1835 bool nulls[4] = {0};
1930 bool is_missing =
false;
1957 bool is_missing =
false;
2006 bool is_missing =
false;
2043 static const priv_map table_priv_map[] = {
2061 {
"RULE WITH GRANT OPTION", 0},
2100 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2101 errmsg(
"\"%s\" is not a sequence",
2130 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2131 errmsg(
"\"%s\" is not a sequence",
2154 bool is_missing =
false;
2159 if (relkind ==
'\0')
2161 else if (relkind != RELKIND_SEQUENCE)
2163 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2164 errmsg(
"\"%s\" is not a sequence",
2190 bool is_missing =
false;
2195 if (relkind ==
'\0')
2197 else if (relkind != RELKIND_SEQUENCE)
2199 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2200 errmsg(
"\"%s\" is not a sequence",
2230 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2231 errmsg(
"\"%s\" is not a sequence",
2253 bool is_missing =
false;
2257 if (relkind ==
'\0')
2259 else if (relkind != RELKIND_SEQUENCE)
2261 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2262 errmsg(
"\"%s\" is not a sequence",
2280 static const priv_map sequence_priv_map[] = {
2377 bool is_missing =
false;
2411 bool is_missing =
false;
2471 bool is_missing =
false;
2519 bool is_missing =
false;
2536 else if (is_missing)
2543 else if (is_missing)
2897 if (attributeForm->attisdropped)
2900 attnum = attributeForm->attnum;
2912 if (tablename != NULL)
2916 (
errcode(ERRCODE_UNDEFINED_COLUMN),
2917 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
2918 colname, tablename)));
2935 static const priv_map column_priv_map[] = {
3025 bool is_missing =
false;
3054 bool is_missing =
false;
3105 bool is_missing =
false;
3141 static const priv_map database_priv_map[] = {
3231 bool is_missing =
false;
3260 bool is_missing =
false;
3311 bool is_missing =
false;
3347 static const priv_map foreign_data_wrapper_priv_map[] = {
3431 bool is_missing =
false;
3460 bool is_missing =
false;
3511 bool is_missing =
false;
3543 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
3556 static const priv_map function_priv_map[] = {
3640 bool is_missing =
false;
3669 bool is_missing =
false;
3720 bool is_missing =
false;
3756 static const priv_map language_priv_map[] = {
3840 bool is_missing =
false;
3869 bool is_missing =
false;
3920 bool is_missing =
false;
3956 static const priv_map schema_priv_map[] = {
4042 bool is_missing =
false;
4071 bool is_missing =
false;
4122 bool is_missing =
false;
4158 static const priv_map server_priv_map[] = {
4242 bool is_missing =
false;
4271 bool is_missing =
false;
4322 bool is_missing =
false;
4358 static const priv_map tablespace_priv_map[] = {
4441 bool is_missing =
false;
4470 bool is_missing =
false;
4521 bool is_missing =
false;
4553 (
errcode(ERRCODE_UNDEFINED_OBJECT),
4566 static const priv_map type_priv_map[] = {
4655 static const priv_map parameter_priv_map[] = {
4833 static const priv_map role_priv_map[] = {
4916 if (cacheid == DATABASEOID &&
4935 static inline List *
4938 unsigned char *roleptr = (
unsigned char *) &role;
4997 Oid admin_of,
Oid *admin_role)
5002 List *new_cached_roles;
5007 if (admin_role != NULL)
5046 foreach(l, roles_list)
5059 Oid otherid = form->roleid;
5065 if (otherid == admin_of && form->admin_option &&
5067 *admin_role = memberid;
5089 ROLE_PG_DATABASE_OWNER);
5102 new_cached_roles =
list_copy(roles_list);
5189 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
5190 errmsg(
"must be able to SET ROLE \"%s\"",
5339 const Acl *acl,
Oid ownerId,
5355 *grantorId = ownerId;
5356 *grantOptions = needed_goptions;
5370 *grantorId = roleId;
5374 foreach(l, roles_list)
5381 if (otherprivs == needed_goptions)
5384 *grantorId = otherrole;
5385 *grantOptions = otherprivs;
5397 if (nnewrights > nrights)
5399 *grantorId = otherrole;
5400 *grantOptions = otherprivs;
5401 nrights = nnewrights;
5422 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5434 if (strcmp(
rolname,
"public") == 0)
5470 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5471 errmsg(
"role \"%s\" does not exist",
"public")));
5498 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5517 (
errcode(ERRCODE_UNDEFINED_OBJECT),
5518 errmsg(
"role \"%s\" does not exist",
"public")));
5567 (
errcode(ERRCODE_RESERVED_NAME),
5568 errmsg(
"role name \"%s\" is reserved",
5573 (
errcode(ERRCODE_RESERVED_NAME),
5574 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)
#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_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)
static List * roles_list_append(List *roles_list, bloom_filter **bf, Oid role)
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)
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)
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 * lappend_oid(List *list, Oid datum)
List * list_copy(const List *oldlist)
void list_free(List *list)
bool list_member_oid(const 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)
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
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 *))
MemoryContextSwitchTo(old_ctx)
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)