Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd1e3070

Browse files
committed
Allow type_func_name_keywords in even more places
A while back,2c92eda allowedtype_func_name_keywords to be used in more places, including roleidentifiers. Unfortunately, that commit missed out on cases wherename_list was used for lists-of-roles, eg: for DROP ROLE. Thisresulted in the unfortunate situation that you could CREATE a rolewith a type_func_name_keywords-allowed identifier, but not DROP it(directly- ALTER could be used to rename it to something whichcould be DROP'd).This extends allowing type_func_name_keywords to places where rolelists can be used.Back-patch to 9.0, as2c92eda was.
1 parent0950d67 commitd1e3070

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

‎src/backend/parser/gram.y

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
329329
oper_argtypesRuleActionListRuleActionMulti
330330
opt_column_listcolumnListopt_name_list
331331
sort_clauseopt_sort_clausesortby_listindex_params
332-
name_listfrom_clausefrom_listopt_array_bounds
332+
name_listrole_listfrom_clausefrom_listopt_array_bounds
333333
qualified_name_listany_nameany_name_list
334334
any_operatorexpr_listattrs
335335
target_listinsert_column_listset_target_list
@@ -889,7 +889,7 @@ AlterOptRoleElem:
889889
$$ = makeDefElem("validUntil", (Node *)makeString($3));
890890
}
891891
/*Supported but not documented for roles, for use by ALTER GROUP.*/
892-
|USERname_list
892+
|USERrole_list
893893
{
894894
$$ = makeDefElem("rolemembers", (Node *)$2);
895895
}
@@ -953,19 +953,19 @@ CreateOptRoleElem:
953953
{
954954
$$ = makeDefElem("sysid", (Node *)makeInteger($2));
955955
}
956-
|ADMINname_list
956+
|ADMINrole_list
957957
{
958958
$$ = makeDefElem("adminmembers", (Node *)$2);
959959
}
960-
|ROLEname_list
960+
|ROLErole_list
961961
{
962962
$$ = makeDefElem("rolemembers", (Node *)$2);
963963
}
964-
|IN_PROLEname_list
964+
|IN_PROLErole_list
965965
{
966966
$$ = makeDefElem("addroleto", (Node *)$3);
967967
}
968-
|IN_PGROUP_Pname_list
968+
|IN_PGROUP_Prole_list
969969
{
970970
$$ = makeDefElem("addroleto", (Node *)$3);
971971
}
@@ -1072,14 +1072,14 @@ AlterUserSetStmt:
10721072
*****************************************************************************/
10731073

10741074
DropRoleStmt:
1075-
DROPROLEname_list
1075+
DROPROLErole_list
10761076
{
10771077
DropRoleStmt *n = makeNode(DropRoleStmt);
10781078
n->missing_ok =FALSE;
10791079
n->roles =$3;
10801080
$$ = (Node *)n;
10811081
}
1082-
|DROPROLEIF_PEXISTSname_list
1082+
|DROPROLEIF_PEXISTSrole_list
10831083
{
10841084
DropRoleStmt *n = makeNode(DropRoleStmt);
10851085
n->missing_ok =TRUE;
@@ -1098,14 +1098,14 @@ DropRoleStmt:
10981098
*****************************************************************************/
10991099

11001100
DropUserStmt:
1101-
DROPUSERname_list
1101+
DROPUSERrole_list
11021102
{
11031103
DropRoleStmt *n = makeNode(DropRoleStmt);
11041104
n->missing_ok =FALSE;
11051105
n->roles =$3;
11061106
$$ = (Node *)n;
11071107
}
1108-
|DROPUSERIF_PEXISTSname_list
1108+
|DROPUSERIF_PEXISTSrole_list
11091109
{
11101110
DropRoleStmt *n = makeNode(DropRoleStmt);
11111111
n->roles =$5;
@@ -1140,7 +1140,7 @@ CreateGroupStmt:
11401140
*****************************************************************************/
11411141

11421142
AlterGroupStmt:
1143-
ALTERGROUP_PRoleIdadd_dropUSERname_list
1143+
ALTERGROUP_PRoleIdadd_dropUSERrole_list
11441144
{
11451145
AlterRoleStmt *n = makeNode(AlterRoleStmt);
11461146
n->role =$3;
@@ -1164,14 +1164,14 @@ add_drop:ADD_P{ $$ = +1; }
11641164
*****************************************************************************/
11651165

11661166
DropGroupStmt:
1167-
DROPGROUP_Pname_list
1167+
DROPGROUP_Prole_list
11681168
{
11691169
DropRoleStmt *n = makeNode(DropRoleStmt);
11701170
n->missing_ok =FALSE;
11711171
n->roles =$3;
11721172
$$ = (Node *)n;
11731173
}
1174-
|DROPGROUP_PIF_PEXISTSname_list
1174+
|DROPGROUP_PIF_PEXISTSrole_list
11751175
{
11761176
DropRoleStmt *n = makeNode(DropRoleStmt);
11771177
n->missing_ok =TRUE;
@@ -5047,7 +5047,7 @@ DropOpFamilyStmt:
50475047
*
50485048
*****************************************************************************/
50495049
DropOwnedStmt:
5050-
DROPOWNEDBYname_listopt_drop_behavior
5050+
DROPOWNEDBYrole_listopt_drop_behavior
50515051
{
50525052
DropOwnedStmt *n = makeNode(DropOwnedStmt);
50535053
n->roles =$4;
@@ -5057,7 +5057,7 @@ DropOwnedStmt:
50575057
;
50585058

50595059
ReassignOwnedStmt:
5060-
REASSIGNOWNEDBYname_listTOname
5060+
REASSIGNOWNEDBYrole_listTOname
50615061
{
50625062
ReassignOwnedStmt *n = makeNode(ReassignOwnedStmt);
50635063
n->roles =$4;
@@ -5923,7 +5923,7 @@ function_with_argtypes:
59235923
*****************************************************************************/
59245924

59255925
GrantRoleStmt:
5926-
GRANTprivilege_listTOname_listopt_grant_admin_optionopt_granted_by
5926+
GRANTprivilege_listTOrole_listopt_grant_admin_optionopt_granted_by
59275927
{
59285928
GrantRoleStmt *n = makeNode(GrantRoleStmt);
59295929
n->is_grant =true;
@@ -5936,7 +5936,7 @@ GrantRoleStmt:
59365936
;
59375937

59385938
RevokeRoleStmt:
5939-
REVOKEprivilege_listFROMname_listopt_granted_byopt_drop_behavior
5939+
REVOKEprivilege_listFROMrole_listopt_granted_byopt_drop_behavior
59405940
{
59415941
GrantRoleStmt *n = makeNode(GrantRoleStmt);
59425942
n->is_grant =false;
@@ -5946,7 +5946,7 @@ RevokeRoleStmt:
59465946
n->behavior =$6;
59475947
$$ = (Node*)n;
59485948
}
5949-
|REVOKEADMINOPTIONFORprivilege_listFROMname_listopt_granted_byopt_drop_behavior
5949+
|REVOKEADMINOPTIONFORprivilege_listFROMrole_listopt_granted_byopt_drop_behavior
59505950
{
59515951
GrantRoleStmt *n = makeNode(GrantRoleStmt);
59525952
n->is_grant =false;
@@ -5992,11 +5992,11 @@ DefACLOption:
59925992
{
59935993
$$ = makeDefElem("schemas", (Node *)$3);
59945994
}
5995-
|FORROLEname_list
5995+
|FORROLErole_list
59965996
{
59975997
$$ = makeDefElem("roles", (Node *)$3);
59985998
}
5999-
|FORUSERname_list
5999+
|FORUSERrole_list
60006000
{
60016001
$$ = makeDefElem("roles", (Node *)$3);
60026002
}
@@ -12587,6 +12587,12 @@ Iconst:ICONST{ $$ = $1; };
1258712587
Sconst:SCONST{ $$ = $1; };
1258812588
RoleId:NonReservedWord{ $$ = $1; };
1258912589

12590+
role_list:RoleId
12591+
{ $$ =list_make1(makeString($1)); }
12592+
| role_list',' RoleId
12593+
{ $$ =lappend($1,makeString($3)); }
12594+
;
12595+
1259012596
SignedIconst: Iconst{ $$ = $1; }
1259112597
|'+' Iconst{ $$ = + $2; }
1259212598
|'-' Iconst{ $$ = - $2; }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp