diff --git a/compute_tools/src/compute.rs b/compute_tools/src/compute.rs index 3546cb137c..846773a8e5 100644 --- a/compute_tools/src/compute.rs +++ b/compute_tools/src/compute.rs @@ -1443,8 +1443,8 @@ LIMIT 100", .iter() // should not be quoted as it's part of the command. // is already sanitized so it's ok - .map(|p| serde_json::to_string(p).unwrap()) - .collect::>() + .map(|p| p.as_str()) + .collect::>() .join(", "), // quote the schema and role name as identifiers to sanitize them. schema_name.to_string().pg_quote(), diff --git a/libs/compute_api/src/privilege.rs b/libs/compute_api/src/privilege.rs index bdb8cfa753..dc0d870946 100644 --- a/libs/compute_api/src/privilege.rs +++ b/libs/compute_api/src/privilege.rs @@ -14,3 +14,22 @@ pub enum Privilege { Temporary, Execute, } + +impl Privilege { + pub fn as_str(&self) -> &'static str { + match self { + Privilege::Select => "SELECT", + Privilege::Insert => "INSERT", + Privilege::Update => "UPDATE", + Privilege::Delete => "DELETE", + Privilege::Truncate => "TRUNCATE", + Privilege::References => "REFERENCES", + Privilege::Trigger => "TRIGGER", + Privilege::Usage => "USAGE", + Privilege::Create => "CREATE", + Privilege::Connect => "CONNECT", + Privilege::Temporary => "TEMPORARY", + Privilege::Execute => "EXECUTE", + } + } +}