mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
Add Snowflake COPY/REVOKE CURRENT GRANTS
option (#1926)
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
This commit is contained in:
parent
1a33abda63
commit
93450cc250
4 changed files with 40 additions and 0 deletions
|
@ -3996,6 +3996,7 @@ pub enum Statement {
|
|||
with_grant_option: bool,
|
||||
as_grantor: Option<Ident>,
|
||||
granted_by: Option<Ident>,
|
||||
current_grants: Option<CurrentGrantsKind>,
|
||||
},
|
||||
/// ```sql
|
||||
/// DENY privileges ON object TO grantees
|
||||
|
@ -4312,6 +4313,28 @@ pub enum Statement {
|
|||
Return(ReturnStatement),
|
||||
}
|
||||
|
||||
/// ```sql
|
||||
/// {COPY | REVOKE} CURRENT GRANTS
|
||||
/// ```
|
||||
///
|
||||
/// - [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/grant-ownership#optional-parameters)
|
||||
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
|
||||
pub enum CurrentGrantsKind {
|
||||
CopyCurrentGrants,
|
||||
RevokeCurrentGrants,
|
||||
}
|
||||
|
||||
impl fmt::Display for CurrentGrantsKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
CurrentGrantsKind::CopyCurrentGrants => write!(f, "COPY CURRENT GRANTS"),
|
||||
CurrentGrantsKind::RevokeCurrentGrants => write!(f, "REVOKE CURRENT GRANTS"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
|
||||
|
@ -5715,6 +5738,7 @@ impl fmt::Display for Statement {
|
|||
with_grant_option,
|
||||
as_grantor,
|
||||
granted_by,
|
||||
current_grants,
|
||||
} => {
|
||||
write!(f, "GRANT {privileges} ")?;
|
||||
if let Some(objects) = objects {
|
||||
|
@ -5724,6 +5748,9 @@ impl fmt::Display for Statement {
|
|||
if *with_grant_option {
|
||||
write!(f, " WITH GRANT OPTION")?;
|
||||
}
|
||||
if let Some(current_grants) = current_grants {
|
||||
write!(f, " {current_grants}")?;
|
||||
}
|
||||
if let Some(grantor) = as_grantor {
|
||||
write!(f, " AS {grantor}")?;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue