Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query):user option DEFAULT_ROLE ignore ascii_case #15137

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading