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

Commitc0e6169

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 parent27ab1eb commitc0e6169

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
@@ -306,7 +306,7 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
306306
oper_argtypesRuleActionListRuleActionMulti
307307
opt_column_listcolumnListopt_name_list
308308
sort_clauseopt_sort_clausesortby_listindex_params
309-
name_listfrom_clausefrom_listopt_array_bounds
309+
name_listrole_listfrom_clausefrom_listopt_array_bounds
310310
qualified_name_listany_nameany_name_list
311311
any_operatorexpr_listattrs
312312
target_listinsert_column_listset_target_list
@@ -860,7 +860,7 @@ AlterOptRoleElem:
860860
$$ = makeDefElem("validUntil", (Node *)makeString($3));
861861
}
862862
/*Supported but not documented for roles, for use by ALTER GROUP.*/
863-
|USERname_list
863+
|USERrole_list
864864
{
865865
$$ = makeDefElem("rolemembers", (Node *)$2);
866866
}
@@ -924,19 +924,19 @@ CreateOptRoleElem:
924924
{
925925
$$ = makeDefElem("sysid", (Node *)makeInteger($2));
926926
}
927-
|ADMINname_list
927+
|ADMINrole_list
928928
{
929929
$$ = makeDefElem("adminmembers", (Node *)$2);
930930
}
931-
|ROLEname_list
931+
|ROLErole_list
932932
{
933933
$$ = makeDefElem("rolemembers", (Node *)$2);
934934
}
935-
|IN_PROLEname_list
935+
|IN_PROLErole_list
936936
{
937937
$$ = makeDefElem("addroleto", (Node *)$3);
938938
}
939-
|IN_PGROUP_Pname_list
939+
|IN_PGROUP_Prole_list
940940
{
941941
$$ = makeDefElem("addroleto", (Node *)$3);
942942
}
@@ -1035,14 +1035,14 @@ AlterUserSetStmt:
10351035
*****************************************************************************/
10361036

10371037
DropRoleStmt:
1038-
DROPROLEname_list
1038+
DROPROLErole_list
10391039
{
10401040
DropRoleStmt *n = makeNode(DropRoleStmt);
10411041
n->missing_ok =FALSE;
10421042
n->roles =$3;
10431043
$$ = (Node *)n;
10441044
}
1045-
|DROPROLEIF_PEXISTSname_list
1045+
|DROPROLEIF_PEXISTSrole_list
10461046
{
10471047
DropRoleStmt *n = makeNode(DropRoleStmt);
10481048
n->missing_ok =TRUE;
@@ -1061,14 +1061,14 @@ DropRoleStmt:
10611061
*****************************************************************************/
10621062

10631063
DropUserStmt:
1064-
DROPUSERname_list
1064+
DROPUSERrole_list
10651065
{
10661066
DropRoleStmt *n = makeNode(DropRoleStmt);
10671067
n->missing_ok =FALSE;
10681068
n->roles =$3;
10691069
$$ = (Node *)n;
10701070
}
1071-
|DROPUSERIF_PEXISTSname_list
1071+
|DROPUSERIF_PEXISTSrole_list
10721072
{
10731073
DropRoleStmt *n = makeNode(DropRoleStmt);
10741074
n->roles =$5;
@@ -1103,7 +1103,7 @@ CreateGroupStmt:
11031103
*****************************************************************************/
11041104

11051105
AlterGroupStmt:
1106-
ALTERGROUP_PRoleIdadd_dropUSERname_list
1106+
ALTERGROUP_PRoleIdadd_dropUSERrole_list
11071107
{
11081108
AlterRoleStmt *n = makeNode(AlterRoleStmt);
11091109
n->role =$3;
@@ -1127,14 +1127,14 @@ add_drop:ADD_P{ $$ = +1; }
11271127
*****************************************************************************/
11281128

11291129
DropGroupStmt:
1130-
DROPGROUP_Pname_list
1130+
DROPGROUP_Prole_list
11311131
{
11321132
DropRoleStmt *n = makeNode(DropRoleStmt);
11331133
n->missing_ok =FALSE;
11341134
n->roles =$3;
11351135
$$ = (Node *)n;
11361136
}
1137-
|DROPGROUP_PIF_PEXISTSname_list
1137+
|DROPGROUP_PIF_PEXISTSrole_list
11381138
{
11391139
DropRoleStmt *n = makeNode(DropRoleStmt);
11401140
n->missing_ok =TRUE;
@@ -4790,7 +4790,7 @@ DropOpFamilyStmt:
47904790
*
47914791
*****************************************************************************/
47924792
DropOwnedStmt:
4793-
DROPOWNEDBYname_listopt_drop_behavior
4793+
DROPOWNEDBYrole_listopt_drop_behavior
47944794
{
47954795
DropOwnedStmt *n = makeNode(DropOwnedStmt);
47964796
n->roles =$4;
@@ -4800,7 +4800,7 @@ DropOwnedStmt:
48004800
;
48014801

48024802
ReassignOwnedStmt:
4803-
REASSIGNOWNEDBYname_listTOname
4803+
REASSIGNOWNEDBYrole_listTOname
48044804
{
48054805
ReassignOwnedStmt *n = makeNode(ReassignOwnedStmt);
48064806
n->roles =$4;
@@ -5682,7 +5682,7 @@ function_with_argtypes:
56825682
*****************************************************************************/
56835683

56845684
GrantRoleStmt:
5685-
GRANTprivilege_listTOname_listopt_grant_admin_optionopt_granted_by
5685+
GRANTprivilege_listTOrole_listopt_grant_admin_optionopt_granted_by
56865686
{
56875687
GrantRoleStmt *n = makeNode(GrantRoleStmt);
56885688
n->is_grant =true;
@@ -5695,7 +5695,7 @@ GrantRoleStmt:
56955695
;
56965696

56975697
RevokeRoleStmt:
5698-
REVOKEprivilege_listFROMname_listopt_granted_byopt_drop_behavior
5698+
REVOKEprivilege_listFROMrole_listopt_granted_byopt_drop_behavior
56995699
{
57005700
GrantRoleStmt *n = makeNode(GrantRoleStmt);
57015701
n->is_grant =false;
@@ -5705,7 +5705,7 @@ RevokeRoleStmt:
57055705
n->behavior =$6;
57065706
$$ = (Node*)n;
57075707
}
5708-
|REVOKEADMINOPTIONFORprivilege_listFROMname_listopt_granted_byopt_drop_behavior
5708+
|REVOKEADMINOPTIONFORprivilege_listFROMrole_listopt_granted_byopt_drop_behavior
57095709
{
57105710
GrantRoleStmt *n = makeNode(GrantRoleStmt);
57115711
n->is_grant =false;
@@ -5751,11 +5751,11 @@ DefACLOption:
57515751
{
57525752
$$ = makeDefElem("schemas", (Node *)$3);
57535753
}
5754-
|FORROLEname_list
5754+
|FORROLErole_list
57555755
{
57565756
$$ = makeDefElem("roles", (Node *)$3);
57575757
}
5758-
|FORUSERname_list
5758+
|FORUSERrole_list
57595759
{
57605760
$$ = makeDefElem("roles", (Node *)$3);
57615761
}
@@ -12204,6 +12204,12 @@ Iconst:ICONST{ $$ = $1; };
1220412204
Sconst:SCONST{ $$ = $1; };
1220512205
RoleId:NonReservedWord{ $$ = $1; };
1220612206

12207+
role_list:RoleId
12208+
{ $$ =list_make1(makeString($1)); }
12209+
| role_list',' RoleId
12210+
{ $$ =lappend($1,makeString($3)); }
12211+
;
12212+
1220712213
SignedIconst: Iconst{ $$ = $1; }
1220812214
|'+' Iconst{ $$ = + $2; }
1220912215
|'-' Iconst{ $$ = - $2; }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp