add paranthesis to the unary expression printer

This commit is contained in:
alpaylan
2025-07-06 14:58:29 -04:00
parent 2124cc41c0
commit b0cf2ba92c
4 changed files with 6 additions and 8 deletions

View File

@@ -262,9 +262,11 @@ impl ToSqlString for Expr {
ret.push(')');
}
Expr::Unary(unary_operator, expr) => {
ret.push('(');
ret.push_str(&unary_operator.to_string());
ret.push(' ');
ret.push_str(&expr.to_sql_string(context));
ret.push(')');
}
Expr::Variable(variable) => {
ret.push_str(variable);

View File

@@ -77,7 +77,7 @@ impl ToSqlString for ast::OneSelect {
impl ToSqlString for ast::SelectInner {
fn to_sql_string<C: ToSqlContext>(&self, context: &C) -> String {
dbg!(&self);
// dbg!(&self);
let mut ret = Vec::with_capacity(2 + self.columns.len());
ret.push("SELECT".to_string());
if let Some(distinct) = self.distinctness {