mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 05:30:19 +00:00
Support 'SET ROLE' statement (#455)
This commit is contained in:
parent
7480e89f7b
commit
8f207db059
3 changed files with 79 additions and 0 deletions
|
@ -3116,7 +3116,19 @@ impl<'a> Parser<'a> {
|
|||
self.parse_one_of_keywords(&[Keyword::SESSION, Keyword::LOCAL, Keyword::HIVEVAR]);
|
||||
if let Some(Keyword::HIVEVAR) = modifier {
|
||||
self.expect_token(&Token::Colon)?;
|
||||
} else if self.parse_keyword(Keyword::ROLE) {
|
||||
let role_name = if self.parse_keyword(Keyword::NONE) {
|
||||
None
|
||||
} else {
|
||||
Some(self.parse_identifier()?)
|
||||
};
|
||||
return Ok(Statement::SetRole {
|
||||
local: modifier == Some(Keyword::LOCAL),
|
||||
session: modifier == Some(Keyword::SESSION),
|
||||
role_name,
|
||||
});
|
||||
}
|
||||
|
||||
let variable = self.parse_identifier()?;
|
||||
if self.consume_token(&Token::Eq) || self.parse_keyword(Keyword::TO) {
|
||||
let mut values = vec![];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue