mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
Add support for GRANT <P> ON ALL VIEWS IN SCHEMA
This commit is contained in:
parent
239e30a97c
commit
e1e0087787
3 changed files with 19 additions and 0 deletions
|
@ -6928,6 +6928,8 @@ pub enum GrantObjects {
|
|||
AllSequencesInSchema { schemas: Vec<ObjectName> },
|
||||
/// Grant privileges on `ALL TABLES IN SCHEMA <schema_name> [, ...]`
|
||||
AllTablesInSchema { schemas: Vec<ObjectName> },
|
||||
/// Grant privileges on `ALL VIEWS IN SCHEMA <schema_name> [, ...]`
|
||||
AllViewsInSchema { schemas: Vec<ObjectName> },
|
||||
/// Grant privileges on `FUTURE SCHEMAS IN DATABASE <database_name> [, ...]`
|
||||
FutureSchemasInDatabase { databases: Vec<ObjectName> },
|
||||
/// Grant privileges on `FUTURE TABLES IN SCHEMA <schema_name> [, ...]`
|
||||
|
@ -7002,6 +7004,13 @@ impl fmt::Display for GrantObjects {
|
|||
display_comma_separated(schemas)
|
||||
)
|
||||
}
|
||||
GrantObjects::AllViewsInSchema { schemas } => {
|
||||
write!(
|
||||
f,
|
||||
"ALL VIEWS IN SCHEMA {}",
|
||||
display_comma_separated(schemas)
|
||||
)
|
||||
}
|
||||
GrantObjects::FutureSchemasInDatabase { databases } => {
|
||||
write!(
|
||||
f,
|
||||
|
|
|
@ -13897,6 +13897,15 @@ impl<'a> Parser<'a> {
|
|||
Some(GrantObjects::AllTablesInSchema {
|
||||
schemas: self.parse_comma_separated(|p| p.parse_object_name(false))?,
|
||||
})
|
||||
} else if self.parse_keywords(&[
|
||||
Keyword::ALL,
|
||||
Keyword::VIEWS,
|
||||
Keyword::IN,
|
||||
Keyword::SCHEMA,
|
||||
]) {
|
||||
Some(GrantObjects::AllViewsInSchema {
|
||||
schemas: self.parse_comma_separated(|p| p.parse_object_name(false))?,
|
||||
})
|
||||
} else if self.parse_keywords(&[
|
||||
Keyword::FUTURE,
|
||||
Keyword::SCHEMAS,
|
||||
|
|
|
@ -9414,6 +9414,7 @@ fn parse_grant() {
|
|||
verified_stmt("GRANT SELECT ON ALL TABLES IN SCHEMA db1.sc1 TO APPLICATION role1");
|
||||
verified_stmt("GRANT SELECT ON ALL TABLES IN SCHEMA db1.sc1 TO APPLICATION ROLE role1");
|
||||
verified_stmt("GRANT SELECT ON ALL TABLES IN SCHEMA db1.sc1 TO SHARE share1");
|
||||
verified_stmt("GRANT SELECT ON ALL VIEWS IN SCHEMA db1.sc1 TO ROLE role1");
|
||||
verified_stmt("GRANT USAGE ON SCHEMA sc1 TO a:b");
|
||||
verified_stmt("GRANT USAGE ON SCHEMA sc1 TO GROUP group1");
|
||||
verified_stmt("GRANT OWNERSHIP ON ALL TABLES IN SCHEMA DEV_STAS_ROGOZHIN TO ROLE ANALYST");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue