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

Commit6c36f38

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 parent69c7a98 commit6c36f38

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
@@ -334,7 +334,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
334334
oper_argtypesRuleActionListRuleActionMulti
335335
opt_column_listcolumnListopt_name_list
336336
sort_clauseopt_sort_clausesortby_listindex_params
337-
name_listfrom_clausefrom_listopt_array_bounds
337+
name_listrole_listfrom_clausefrom_listopt_array_bounds
338338
qualified_name_listany_nameany_name_list
339339
any_operatorexpr_listattrs
340340
target_listopt_target_listinsert_column_listset_target_list
@@ -901,7 +901,7 @@ AlterOptRoleElem:
901901
$$ = makeDefElem("validUntil", (Node *)makeString($3));
902902
}
903903
/*Supported but not documented for roles, for use by ALTER GROUP.*/
904-
|USERname_list
904+
|USERrole_list
905905
{
906906
$$ = makeDefElem("rolemembers", (Node *)$2);
907907
}
@@ -965,19 +965,19 @@ CreateOptRoleElem:
965965
{
966966
$$ = makeDefElem("sysid", (Node *)makeInteger($2));
967967
}
968-
|ADMINname_list
968+
|ADMINrole_list
969969
{
970970
$$ = makeDefElem("adminmembers", (Node *)$2);
971971
}
972-
|ROLEname_list
972+
|ROLErole_list
973973
{
974974
$$ = makeDefElem("rolemembers", (Node *)$2);
975975
}
976-
|IN_PROLEname_list
976+
|IN_PROLErole_list
977977
{
978978
$$ = makeDefElem("addroleto", (Node *)$3);
979979
}
980-
|IN_PGROUP_Pname_list
980+
|IN_PGROUP_Prole_list
981981
{
982982
$$ = makeDefElem("addroleto", (Node *)$3);
983983
}
@@ -1084,14 +1084,14 @@ AlterUserSetStmt:
10841084
*****************************************************************************/
10851085

10861086
DropRoleStmt:
1087-
DROPROLEname_list
1087+
DROPROLErole_list
10881088
{
10891089
DropRoleStmt *n = makeNode(DropRoleStmt);
10901090
n->missing_ok =FALSE;
10911091
n->roles =$3;
10921092
$$ = (Node *)n;
10931093
}
1094-
|DROPROLEIF_PEXISTSname_list
1094+
|DROPROLEIF_PEXISTSrole_list
10951095
{
10961096
DropRoleStmt *n = makeNode(DropRoleStmt);
10971097
n->missing_ok =TRUE;
@@ -1110,14 +1110,14 @@ DropRoleStmt:
11101110
*****************************************************************************/
11111111

11121112
DropUserStmt:
1113-
DROPUSERname_list
1113+
DROPUSERrole_list
11141114
{
11151115
DropRoleStmt *n = makeNode(DropRoleStmt);
11161116
n->missing_ok =FALSE;
11171117
n->roles =$3;
11181118
$$ = (Node *)n;
11191119
}
1120-
|DROPUSERIF_PEXISTSname_list
1120+
|DROPUSERIF_PEXISTSrole_list
11211121
{
11221122
DropRoleStmt *n = makeNode(DropRoleStmt);
11231123
n->roles =$5;
@@ -1152,7 +1152,7 @@ CreateGroupStmt:
11521152
*****************************************************************************/
11531153

11541154
AlterGroupStmt:
1155-
ALTERGROUP_PRoleIdadd_dropUSERname_list
1155+
ALTERGROUP_PRoleIdadd_dropUSERrole_list
11561156
{
11571157
AlterRoleStmt *n = makeNode(AlterRoleStmt);
11581158
n->role =$3;
@@ -1176,14 +1176,14 @@ add_drop:ADD_P{ $$ = +1; }
11761176
*****************************************************************************/
11771177

11781178
DropGroupStmt:
1179-
DROPGROUP_Pname_list
1179+
DROPGROUP_Prole_list
11801180
{
11811181
DropRoleStmt *n = makeNode(DropRoleStmt);
11821182
n->missing_ok =FALSE;
11831183
n->roles =$3;
11841184
$$ = (Node *)n;
11851185
}
1186-
|DROPGROUP_PIF_PEXISTSname_list
1186+
|DROPGROUP_PIF_PEXISTSrole_list
11871187
{
11881188
DropRoleStmt *n = makeNode(DropRoleStmt);
11891189
n->missing_ok =TRUE;
@@ -5122,7 +5122,7 @@ DropOpFamilyStmt:
51225122
*
51235123
*****************************************************************************/
51245124
DropOwnedStmt:
5125-
DROPOWNEDBYname_listopt_drop_behavior
5125+
DROPOWNEDBYrole_listopt_drop_behavior
51265126
{
51275127
DropOwnedStmt *n = makeNode(DropOwnedStmt);
51285128
n->roles =$4;
@@ -5132,7 +5132,7 @@ DropOwnedStmt:
51325132
;
51335133

51345134
ReassignOwnedStmt:
5135-
REASSIGNOWNEDBYname_listTOname
5135+
REASSIGNOWNEDBYrole_listTOname
51365136
{
51375137
ReassignOwnedStmt *n = makeNode(ReassignOwnedStmt);
51385138
n->roles =$4;
@@ -5998,7 +5998,7 @@ function_with_argtypes:
59985998
*****************************************************************************/
59995999

60006000
GrantRoleStmt:
6001-
GRANTprivilege_listTOname_listopt_grant_admin_optionopt_granted_by
6001+
GRANTprivilege_listTOrole_listopt_grant_admin_optionopt_granted_by
60026002
{
60036003
GrantRoleStmt *n = makeNode(GrantRoleStmt);
60046004
n->is_grant =true;
@@ -6011,7 +6011,7 @@ GrantRoleStmt:
60116011
;
60126012

60136013
RevokeRoleStmt:
6014-
REVOKEprivilege_listFROMname_listopt_granted_byopt_drop_behavior
6014+
REVOKEprivilege_listFROMrole_listopt_granted_byopt_drop_behavior
60156015
{
60166016
GrantRoleStmt *n = makeNode(GrantRoleStmt);
60176017
n->is_grant =false;
@@ -6021,7 +6021,7 @@ RevokeRoleStmt:
60216021
n->behavior =$6;
60226022
$$ = (Node*)n;
60236023
}
6024-
|REVOKEADMINOPTIONFORprivilege_listFROMname_listopt_granted_byopt_drop_behavior
6024+
|REVOKEADMINOPTIONFORprivilege_listFROMrole_listopt_granted_byopt_drop_behavior
60256025
{
60266026
GrantRoleStmt *n = makeNode(GrantRoleStmt);
60276027
n->is_grant =false;
@@ -6067,11 +6067,11 @@ DefACLOption:
60676067
{
60686068
$$ = makeDefElem("schemas", (Node *)$3);
60696069
}
6070-
|FORROLEname_list
6070+
|FORROLErole_list
60716071
{
60726072
$$ = makeDefElem("roles", (Node *)$3);
60736073
}
6074-
|FORUSERname_list
6074+
|FORUSERrole_list
60756075
{
60766076
$$ = makeDefElem("roles", (Node *)$3);
60776077
}
@@ -12624,6 +12624,12 @@ Iconst:ICONST{ $$ = $1; };
1262412624
Sconst:SCONST{ $$ = $1; };
1262512625
RoleId:NonReservedWord{ $$ = $1; };
1262612626

12627+
role_list:RoleId
12628+
{ $$ =list_make1(makeString($1)); }
12629+
| role_list',' RoleId
12630+
{ $$ =lappend($1,makeString($3)); }
12631+
;
12632+
1262712633
SignedIconst: Iconst{ $$ = $1; }
1262812634
|'+' Iconst{ $$ = + $2; }
1262912635
|'-' Iconst{ $$ = - $2; }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp