aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/parser/gram.y48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 5f80fe057bc..eb4b57327e7 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -306,7 +306,7 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
oper_argtypes RuleActionList RuleActionMulti
opt_column_list columnList opt_name_list
sort_clause opt_sort_clause sortby_list index_params
- name_list from_clause from_list opt_array_bounds
+ name_list role_list from_clause from_list opt_array_bounds
qualified_name_list any_name any_name_list
any_operator expr_list attrs
target_list insert_column_list set_target_list
@@ -861,7 +861,7 @@ AlterOptRoleElem:
$$ = makeDefElem("validUntil", (Node *)makeString($3));
}
/* Supported but not documented for roles, for use by ALTER GROUP. */
- | USER name_list
+ | USER role_list
{
$$ = makeDefElem("rolemembers", (Node *)$2);
}
@@ -925,19 +925,19 @@ CreateOptRoleElem:
{
$$ = makeDefElem("sysid", (Node *)makeInteger($2));
}
- | ADMIN name_list
+ | ADMIN role_list
{
$$ = makeDefElem("adminmembers", (Node *)$2);
}
- | ROLE name_list
+ | ROLE role_list
{
$$ = makeDefElem("rolemembers", (Node *)$2);
}
- | IN_P ROLE name_list
+ | IN_P ROLE role_list
{
$$ = makeDefElem("addroleto", (Node *)$3);
}
- | IN_P GROUP_P name_list
+ | IN_P GROUP_P role_list
{
$$ = makeDefElem("addroleto", (Node *)$3);
}
@@ -1036,14 +1036,14 @@ AlterUserSetStmt:
*****************************************************************************/
DropRoleStmt:
- DROP ROLE name_list
+ DROP ROLE role_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = FALSE;
n->roles = $3;
$$ = (Node *)n;
}
- | DROP ROLE IF_P EXISTS name_list
+ | DROP ROLE IF_P EXISTS role_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = TRUE;
@@ -1062,14 +1062,14 @@ DropRoleStmt:
*****************************************************************************/
DropUserStmt:
- DROP USER name_list
+ DROP USER role_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = FALSE;
n->roles = $3;
$$ = (Node *)n;
}
- | DROP USER IF_P EXISTS name_list
+ | DROP USER IF_P EXISTS role_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->roles = $5;
@@ -1104,7 +1104,7 @@ CreateGroupStmt:
*****************************************************************************/
AlterGroupStmt:
- ALTER GROUP_P RoleId add_drop USER name_list
+ ALTER GROUP_P RoleId add_drop USER role_list
{
AlterRoleStmt *n = makeNode(AlterRoleStmt);
n->role = $3;
@@ -1128,14 +1128,14 @@ add_drop: ADD_P { $$ = +1; }
*****************************************************************************/
DropGroupStmt:
- DROP GROUP_P name_list
+ DROP GROUP_P role_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = FALSE;
n->roles = $3;
$$ = (Node *)n;
}
- | DROP GROUP_P IF_P EXISTS name_list
+ | DROP GROUP_P IF_P EXISTS role_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = TRUE;
@@ -4688,8 +4688,8 @@ DropOpFamilyStmt:
*
*****************************************************************************/
DropOwnedStmt:
- DROP OWNED BY name_list opt_drop_behavior
- {
+ DROP OWNED BY role_list opt_drop_behavior
+ {
DropOwnedStmt *n = makeNode(DropOwnedStmt);
n->roles = $4;
n->behavior = $5;
@@ -4698,7 +4698,7 @@ DropOwnedStmt:
;
ReassignOwnedStmt:
- REASSIGN OWNED BY name_list TO name
+ REASSIGN OWNED BY role_list TO name
{
ReassignOwnedStmt *n = makeNode(ReassignOwnedStmt);
n->roles = $4;
@@ -5535,7 +5535,7 @@ function_with_argtypes:
*****************************************************************************/
GrantRoleStmt:
- GRANT privilege_list TO name_list opt_grant_admin_option opt_granted_by
+ GRANT privilege_list TO role_list opt_grant_admin_option opt_granted_by
{
GrantRoleStmt *n = makeNode(GrantRoleStmt);
n->is_grant = true;
@@ -5548,7 +5548,7 @@ GrantRoleStmt:
;
RevokeRoleStmt:
- REVOKE privilege_list FROM name_list opt_granted_by opt_drop_behavior
+ REVOKE privilege_list FROM role_list opt_granted_by opt_drop_behavior
{
GrantRoleStmt *n = makeNode(GrantRoleStmt);
n->is_grant = false;
@@ -5558,7 +5558,7 @@ RevokeRoleStmt:
n->behavior = $6;
$$ = (Node*)n;
}
- | REVOKE ADMIN OPTION FOR privilege_list FROM name_list opt_granted_by opt_drop_behavior
+ | REVOKE ADMIN OPTION FOR privilege_list FROM role_list opt_granted_by opt_drop_behavior
{
GrantRoleStmt *n = makeNode(GrantRoleStmt);
n->is_grant = false;
@@ -5604,11 +5604,11 @@ DefACLOption:
{
$$ = makeDefElem("schemas", (Node *)$3);
}
- | FOR ROLE name_list
+ | FOR ROLE role_list
{
$$ = makeDefElem("roles", (Node *)$3);
}
- | FOR USER name_list
+ | FOR USER role_list
{
$$ = makeDefElem("roles", (Node *)$3);
}
@@ -11783,6 +11783,12 @@ Iconst: ICONST { $$ = $1; };
Sconst: SCONST { $$ = $1; };
RoleId: NonReservedWord { $$ = $1; };
+role_list: RoleId
+ { $$ = list_make1(makeString($1)); }
+ | role_list ',' RoleId
+ { $$ = lappend($1, makeString($3)); }
+ ;
+
SignedIconst: Iconst { $$ = $1; }
| '+' Iconst { $$ = + $2; }
| '-' Iconst { $$ = - $2; }