Skip to content

Commit 9a07f61

Browse files
authored
Revert "Add support for GRANT on some common Snowflake objects (apache#1699)"
This reverts commit d7bc609.
1 parent c823a37 commit 9a07f61

File tree

3 files changed

+2
-37
lines changed

3 files changed

+2
-37
lines changed

src/ast/mod.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6064,20 +6064,12 @@ pub enum GrantObjects {
60646064
AllSequencesInSchema { schemas: Vec<ObjectName> },
60656065
/// Grant privileges on `ALL TABLES IN SCHEMA <schema_name> [, ...]`
60666066
AllTablesInSchema { schemas: Vec<ObjectName> },
6067-
/// Grant privileges on specific databases
6068-
Databases(Vec<ObjectName>),
60696067
/// Grant privileges on specific schemas
60706068
Schemas(Vec<ObjectName>),
60716069
/// Grant privileges on specific sequences
60726070
Sequences(Vec<ObjectName>),
60736071
/// Grant privileges on specific tables
60746072
Tables(Vec<ObjectName>),
6075-
/// Grant privileges on specific views
6076-
Views(Vec<ObjectName>),
6077-
/// Grant privileges on specific warehouses
6078-
Warehouses(Vec<ObjectName>),
6079-
/// Grant privileges on specific integrations
6080-
Integrations(Vec<ObjectName>),
60816073
}
60826074

60836075
impl fmt::Display for GrantObjects {
@@ -6086,24 +6078,12 @@ impl fmt::Display for GrantObjects {
60866078
GrantObjects::Sequences(sequences) => {
60876079
write!(f, "SEQUENCE {}", display_comma_separated(sequences))
60886080
}
6089-
GrantObjects::Databases(databases) => {
6090-
write!(f, "DATABASE {}", display_comma_separated(databases))
6091-
}
60926081
GrantObjects::Schemas(schemas) => {
60936082
write!(f, "SCHEMA {}", display_comma_separated(schemas))
60946083
}
60956084
GrantObjects::Tables(tables) => {
60966085
write!(f, "{}", display_comma_separated(tables))
60976086
}
6098-
GrantObjects::Views(views) => {
6099-
write!(f, "VIEW {}", display_comma_separated(views))
6100-
}
6101-
GrantObjects::Warehouses(warehouses) => {
6102-
write!(f, "WAREHOUSE {}", display_comma_separated(warehouses))
6103-
}
6104-
GrantObjects::Integrations(integrations) => {
6105-
write!(f, "INTEGRATION {}", display_comma_separated(integrations))
6106-
}
61076087
GrantObjects::AllSequencesInSchema { schemas } => {
61086088
write!(
61096089
f,

src/parser/mod.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12139,24 +12139,13 @@ impl<'a> Parser<'a> {
1213912139
schemas: self.parse_comma_separated(|p| p.parse_object_name(false))?,
1214012140
}
1214112141
} else {
12142-
let object_type = self.parse_one_of_keywords(&[
12143-
Keyword::SEQUENCE,
12144-
Keyword::DATABASE,
12145-
Keyword::SCHEMA,
12146-
Keyword::TABLE,
12147-
Keyword::VIEW,
12148-
Keyword::WAREHOUSE,
12149-
Keyword::INTEGRATION,
12150-
]);
12142+
let object_type =
12143+
self.parse_one_of_keywords(&[Keyword::SEQUENCE, Keyword::SCHEMA, Keyword::TABLE]);
1215112144
let objects =
1215212145
self.parse_comma_separated(|p| p.parse_object_name_with_wildcards(false, true));
1215312146
match object_type {
12154-
Some(Keyword::DATABASE) => GrantObjects::Databases(objects?),
1215512147
Some(Keyword::SCHEMA) => GrantObjects::Schemas(objects?),
1215612148
Some(Keyword::SEQUENCE) => GrantObjects::Sequences(objects?),
12157-
Some(Keyword::WAREHOUSE) => GrantObjects::Warehouses(objects?),
12158-
Some(Keyword::INTEGRATION) => GrantObjects::Integrations(objects?),
12159-
Some(Keyword::VIEW) => GrantObjects::Views(objects?),
1216012149
Some(Keyword::TABLE) | None => GrantObjects::Tables(objects?),
1216112150
_ => unreachable!(),
1216212151
}

tests/sqlparser_common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8779,10 +8779,6 @@ fn parse_grant() {
87798779
verified_stmt("GRANT USAGE ON SCHEMA sc1 TO a:b");
87808780
verified_stmt("GRANT USAGE ON SCHEMA sc1 TO GROUP group1");
87818781
verified_stmt("GRANT OWNERSHIP ON ALL TABLES IN SCHEMA DEV_STAS_ROGOZHIN TO ROLE ANALYST");
8782-
verified_stmt("GRANT USAGE ON DATABASE db1 TO ROLE role1");
8783-
verified_stmt("GRANT USAGE ON WAREHOUSE wh1 TO ROLE role1");
8784-
verified_stmt("GRANT OWNERSHIP ON INTEGRATION int1 TO ROLE role1");
8785-
verified_stmt("GRANT SELECT ON VIEW view1 TO ROLE role1");
87868782
}
87878783

87888784
#[test]

0 commit comments

Comments
 (0)