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

Commitf2eede9

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 parente70c428 commitf2eede9

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

‎src/backend/parser/gram.y

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static TypeName *TableFuncTypeName(List *columns);
286286
oper_argtypesRuleActionListRuleActionMulti
287287
opt_column_listcolumnListopt_name_list
288288
sort_clauseopt_sort_clausesortby_listindex_params
289-
name_listfrom_clausefrom_listopt_array_bounds
289+
name_listrole_listfrom_clausefrom_listopt_array_bounds
290290
qualified_name_listany_nameany_name_list
291291
any_operatorexpr_listattrs
292292
target_listinsert_column_listset_target_list
@@ -866,7 +866,7 @@ AlterOptRoleElem:
866866
$$ = makeDefElem("validUntil", (Node *)makeString($3));
867867
}
868868
/*Supported but not documented for roles, for use by ALTER GROUP.*/
869-
|USERname_list
869+
|USERrole_list
870870
{
871871
$$ = makeDefElem("rolemembers", (Node *)$2);
872872
}
@@ -879,19 +879,19 @@ CreateOptRoleElem:
879879
{
880880
$$ = makeDefElem("sysid", (Node *)makeInteger($2));
881881
}
882-
|ADMINname_list
882+
|ADMINrole_list
883883
{
884884
$$ = makeDefElem("adminmembers", (Node *)$2);
885885
}
886-
|ROLEname_list
886+
|ROLErole_list
887887
{
888888
$$ = makeDefElem("rolemembers", (Node *)$2);
889889
}
890-
|IN_PROLEname_list
890+
|IN_PROLErole_list
891891
{
892892
$$ = makeDefElem("addroleto", (Node *)$3);
893893
}
894-
|IN_PGROUP_Pname_list
894+
|IN_PGROUP_Prole_list
895895
{
896896
$$ = makeDefElem("addroleto", (Node *)$3);
897897
}
@@ -990,14 +990,14 @@ AlterUserSetStmt:
990990
*****************************************************************************/
991991

992992
DropRoleStmt:
993-
DROPROLEname_list
993+
DROPROLErole_list
994994
{
995995
DropRoleStmt *n = makeNode(DropRoleStmt);
996996
n->missing_ok =FALSE;
997997
n->roles =$3;
998998
$$ = (Node *)n;
999999
}
1000-
|DROPROLEIF_PEXISTSname_list
1000+
|DROPROLEIF_PEXISTSrole_list
10011001
{
10021002
DropRoleStmt *n = makeNode(DropRoleStmt);
10031003
n->missing_ok =TRUE;
@@ -1016,14 +1016,14 @@ DropRoleStmt:
10161016
*****************************************************************************/
10171017

10181018
DropUserStmt:
1019-
DROPUSERname_list
1019+
DROPUSERrole_list
10201020
{
10211021
DropRoleStmt *n = makeNode(DropRoleStmt);
10221022
n->missing_ok =FALSE;
10231023
n->roles =$3;
10241024
$$ = (Node *)n;
10251025
}
1026-
|DROPUSERIF_PEXISTSname_list
1026+
|DROPUSERIF_PEXISTSrole_list
10271027
{
10281028
DropRoleStmt *n = makeNode(DropRoleStmt);
10291029
n->roles =$5;
@@ -1058,7 +1058,7 @@ CreateGroupStmt:
10581058
*****************************************************************************/
10591059

10601060
AlterGroupStmt:
1061-
ALTERGROUP_PRoleIdadd_dropUSERname_list
1061+
ALTERGROUP_PRoleIdadd_dropUSERrole_list
10621062
{
10631063
AlterRoleStmt *n = makeNode(AlterRoleStmt);
10641064
n->role =$3;
@@ -1082,14 +1082,14 @@ add_drop:ADD_P{ $$ = +1; }
10821082
*****************************************************************************/
10831083

10841084
DropGroupStmt:
1085-
DROPGROUP_Pname_list
1085+
DROPGROUP_Prole_list
10861086
{
10871087
DropRoleStmt *n = makeNode(DropRoleStmt);
10881088
n->missing_ok =FALSE;
10891089
n->roles =$3;
10901090
$$ = (Node *)n;
10911091
}
1092-
|DROPGROUP_PIF_PEXISTSname_list
1092+
|DROPGROUP_PIF_PEXISTSrole_list
10931093
{
10941094
DropRoleStmt *n = makeNode(DropRoleStmt);
10951095
n->missing_ok =TRUE;
@@ -3997,8 +3997,8 @@ DropOpFamilyStmt:
39973997
*
39983998
*****************************************************************************/
39993999
DropOwnedStmt:
4000-
DROP OWNED BYname_list opt_drop_behavior
4001-
{
4000+
DROP OWNED BYrole_list opt_drop_behavior
4001+
{
40024002
DropOwnedStmt *n = makeNode(DropOwnedStmt);
40034003
n->roles =$4;
40044004
n->behavior =$5;
@@ -4007,7 +4007,7 @@ DropOwnedStmt:
40074007
;
40084008

40094009
ReassignOwnedStmt:
4010-
REASSIGN OWNED BYname_list TO name
4010+
REASSIGN OWNED BYrole_list TO name
40114011
{
40124012
ReassignOwnedStmt *n = makeNode(ReassignOwnedStmt);
40134013
n->roles =$4;
@@ -4748,7 +4748,7 @@ function_with_argtypes:
47484748
*****************************************************************************/
47494749

47504750
GrantRoleStmt:
4751-
GRANT privilege_list TOname_list opt_grant_admin_option opt_granted_by
4751+
GRANT privilege_list TOrole_list opt_grant_admin_option opt_granted_by
47524752
{
47534753
GrantRoleStmt *n = makeNode(GrantRoleStmt);
47544754
n->is_grant =true;
@@ -4761,7 +4761,7 @@ GrantRoleStmt:
47614761
;
47624762

47634763
RevokeRoleStmt:
4764-
REVOKE privilege_list FROMname_list opt_granted_by opt_drop_behavior
4764+
REVOKE privilege_list FROMrole_list opt_granted_by opt_drop_behavior
47654765
{
47664766
GrantRoleStmt *n = makeNode(GrantRoleStmt);
47674767
n->is_grant =false;
@@ -4771,7 +4771,7 @@ RevokeRoleStmt:
47714771
n->behavior =$6;
47724772
$$ = (Node*)n;
47734773
}
4774-
| REVOKE ADMIN OPTION FOR privilege_list FROMname_list opt_granted_by opt_drop_behavior
4774+
| REVOKE ADMIN OPTION FOR privilege_list FROMrole_list opt_granted_by opt_drop_behavior
47754775
{
47764776
GrantRoleStmt *n = makeNode(GrantRoleStmt);
47774777
n->is_grant =false;
@@ -4817,11 +4817,11 @@ DefACLOption:
48174817
{
48184818
$$ = makeDefElem("schemas", (Node *)$3);
48194819
}
4820-
| FOR ROLEname_list
4820+
| FOR ROLErole_list
48214821
{
48224822
$$ = makeDefElem("roles", (Node *)$3);
48234823
}
4824-
| FOR USERname_list
4824+
| FOR USERrole_list
48254825
{
48264826
$$ = makeDefElem("roles", (Node *)$3);
48274827
}
@@ -10778,6 +10778,12 @@ Iconst:ICONST{ $$ = $1; };
1077810778
Sconst:SCONST{ $$ = $1; };
1077910779
RoleId:NonReservedWord{ $$ = $1; };
1078010780

10781+
role_list:RoleId
10782+
{ $$ =list_make1(makeString($1)); }
10783+
| role_list',' RoleId
10784+
{ $$ =lappend($1,makeString($3)); }
10785+
;
10786+
1078110787
SignedIconst: Iconst{ $$ = $1; }
1078210788
|'+' Iconst{ $$ = + $2; }
1078310789
|'-' Iconst{ $$ = - $2; }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp