Skip to content

Commit 7d3b367

Browse files
authored
fix(query):user option DEFAULT_ROLE ignore ascii_case (#15137)
1 parent ccf25ae commit 7d3b367

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

src/query/ast/src/parser/statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3732,7 +3732,7 @@ pub fn user_option(i: Input) -> IResult<UserOptionItem> {
37323732
);
37333733
let default_role_option = map(
37343734
rule! {
3735-
"DEFAULT_ROLE" ~ ^"=" ~ ^#role_name
3735+
DEFAULT_ROLE ~ ^"=" ~ ^#role_name
37363736
},
37373737
|(_, _, role)| UserOptionItem::DefaultRole(role),
37383738
);

src/query/ast/src/parser/token.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ pub enum TokenKind {
763763
NOT,
764764
#[token("NOTENANTSETTING", ignore(ascii_case))]
765765
NOTENANTSETTING,
766+
#[token("DEFAULT_ROLE", ignore(ascii_case))]
767+
DEFAULT_ROLE,
766768
#[token("NULL", ignore(ascii_case))]
767769
NULL,
768770
#[token("NULLABLE", ignore(ascii_case))]

src/query/ast/tests/it/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ fn test_statement() {
179179
r#"CREATE TABLE t(c1 int default 1);"#,
180180
r#"create table abc as (select * from xyz limit 10)"#,
181181
r#"ALTER USER u1 IDENTIFIED BY '123456';"#,
182-
r#"ALTER USER u1 WITH DEFAULT_ROLE = role1;"#,
182+
r#"ALTER USER u1 WITH default_role = role1;"#,
183183
r#"ALTER USER u1 WITH DEFAULT_ROLE = role1, TENANTSETTING;"#,
184184
r#"ALTER USER u1 WITH SET NETWORK POLICY = 'policy1';"#,
185185
r#"ALTER USER u1 WITH UNSET NETWORK POLICY;"#,

src/query/ast/tests/it/testdata/statement.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4518,7 +4518,7 @@ AlterUser(
45184518

45194519

45204520
---------- Input ----------
4521-
ALTER USER u1 WITH DEFAULT_ROLE = role1;
4521+
ALTER USER u1 WITH default_role = role1;
45224522
---------- Output ---------
45234523
ALTER USER 'u1'@'%' WITH DEFAULT_ROLE = 'role1'
45244524
---------- AST ------------

0 commit comments

Comments
 (0)