Skip to content

Commit

Permalink
fix(query):user option DEFAULT_ROLE ignore ascii_case (#15137)
Browse files Browse the repository at this point in the history
  • Loading branch information
TCeason authored Mar 31, 2024
1 parent ccf25ae commit 7d3b367
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/query/ast/src/parser/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3732,7 +3732,7 @@ pub fn user_option(i: Input) -> IResult<UserOptionItem> {
);
let default_role_option = map(
rule! {
"DEFAULT_ROLE" ~ ^"=" ~ ^#role_name
DEFAULT_ROLE ~ ^"=" ~ ^#role_name
},
|(_, _, role)| UserOptionItem::DefaultRole(role),
);
Expand Down
2 changes: 2 additions & 0 deletions src/query/ast/src/parser/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ pub enum TokenKind {
NOT,
#[token("NOTENANTSETTING", ignore(ascii_case))]
NOTENANTSETTING,
#[token("DEFAULT_ROLE", ignore(ascii_case))]
DEFAULT_ROLE,
#[token("NULL", ignore(ascii_case))]
NULL,
#[token("NULLABLE", ignore(ascii_case))]
Expand Down
2 changes: 1 addition & 1 deletion src/query/ast/tests/it/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn test_statement() {
r#"CREATE TABLE t(c1 int default 1);"#,
r#"create table abc as (select * from xyz limit 10)"#,
r#"ALTER USER u1 IDENTIFIED BY '123456';"#,
r#"ALTER USER u1 WITH DEFAULT_ROLE = role1;"#,
r#"ALTER USER u1 WITH default_role = role1;"#,
r#"ALTER USER u1 WITH DEFAULT_ROLE = role1, TENANTSETTING;"#,
r#"ALTER USER u1 WITH SET NETWORK POLICY = 'policy1';"#,
r#"ALTER USER u1 WITH UNSET NETWORK POLICY;"#,
Expand Down
2 changes: 1 addition & 1 deletion src/query/ast/tests/it/testdata/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,7 @@ AlterUser(


---------- Input ----------
ALTER USER u1 WITH DEFAULT_ROLE = role1;
ALTER USER u1 WITH default_role = role1;
---------- Output ---------
ALTER USER 'u1'@'%' WITH DEFAULT_ROLE = 'role1'
---------- AST ------------
Expand Down

0 comments on commit 7d3b367

Please sign in to comment.