Add support for PostgreSQL/Redshift geometric operators (#1723)

This commit is contained in:
benrsatori 2025-02-20 20:50:32 +02:00 committed by GitHub
parent 97f0be6991
commit 339239d0c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 809 additions and 26 deletions

View file

@ -95,6 +95,8 @@ use crate::ast::helpers::stmt_data_loading::{
#[cfg(feature = "visitor")]
pub use visitor::*;
pub use self::data_type::GeometricTypeKind;
mod data_type;
mod dcl;
mod ddl;
@ -1513,7 +1515,15 @@ impl fmt::Display for Expr {
Expr::UnaryOp { op, expr } => {
if op == &UnaryOperator::PGPostfixFactorial {
write!(f, "{expr}{op}")
} else if op == &UnaryOperator::Not {
} else if matches!(
op,
UnaryOperator::Not
| UnaryOperator::Hash
| UnaryOperator::AtDashAt
| UnaryOperator::DoubleAt
| UnaryOperator::QuestionDash
| UnaryOperator::QuestionPipe
) {
write!(f, "{op} {expr}")
} else {
write!(f, "{op}{expr}")