mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
Add support for granting privileges to procedures and functions in Snowflake (#1930)
This commit is contained in:
parent
b1a6d11e12
commit
8f1414efff
3 changed files with 69 additions and 0 deletions
|
@ -7023,6 +7023,25 @@ pub enum GrantObjects {
|
|||
ReplicationGroup(Vec<ObjectName>),
|
||||
/// Grant privileges on external volumes
|
||||
ExternalVolumes(Vec<ObjectName>),
|
||||
/// Grant privileges on a procedure. In dialects that
|
||||
/// support overloading, the argument types must be specified.
|
||||
///
|
||||
/// For example:
|
||||
/// `GRANT USAGE ON PROCEDURE foo(varchar) TO ROLE role1`
|
||||
Procedure {
|
||||
name: ObjectName,
|
||||
arg_types: Vec<DataType>,
|
||||
},
|
||||
|
||||
/// Grant privileges on a function. In dialects that
|
||||
/// support overloading, the argument types must be specified.
|
||||
///
|
||||
/// For example:
|
||||
/// `GRANT USAGE ON FUNCTION foo(varchar) TO ROLE role1`
|
||||
Function {
|
||||
name: ObjectName,
|
||||
arg_types: Vec<DataType>,
|
||||
},
|
||||
}
|
||||
|
||||
impl fmt::Display for GrantObjects {
|
||||
|
@ -7147,6 +7166,20 @@ impl fmt::Display for GrantObjects {
|
|||
GrantObjects::ExternalVolumes(objects) => {
|
||||
write!(f, "EXTERNAL VOLUME {}", display_comma_separated(objects))
|
||||
}
|
||||
GrantObjects::Procedure { name, arg_types } => {
|
||||
write!(f, "PROCEDURE {name}")?;
|
||||
if !arg_types.is_empty() {
|
||||
write!(f, "({})", display_comma_separated(arg_types))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
GrantObjects::Function { name, arg_types } => {
|
||||
write!(f, "FUNCTION {name}")?;
|
||||
if !arg_types.is_empty() {
|
||||
write!(f, "({})", display_comma_separated(arg_types))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue