From dfd9e5dc26090a042dc23eb7e0faff3c9da1c6f4 Mon Sep 17 00:00:00 2001 From: Andi Cuko Date: Tue, 9 Jul 2024 18:46:04 +0200 Subject: [PATCH] ok --- src/dialect_translation/mod.rs | 2 +- src/dialect_translation/postgresql.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dialect_translation/mod.rs b/src/dialect_translation/mod.rs index a5f66eb8..07845dfd 100644 --- a/src/dialect_translation/mod.rs +++ b/src/dialect_translation/mod.rs @@ -114,7 +114,7 @@ macro_rules! function_match_constructor { // expand arms for nary $( - expr::function::Function::$nary => $self.[<$nary:snake>]($args.clone()), + expr::function::Function::$nary => $self.[<$nary:snake>]($args), )* _ => $default } diff --git a/src/dialect_translation/postgresql.rs b/src/dialect_translation/postgresql.rs index 4d807cf3..1f8e806d 100644 --- a/src/dialect_translation/postgresql.rs +++ b/src/dialect_translation/postgresql.rs @@ -284,11 +284,16 @@ mod tests { let rel_with_traslator = RelationWithTranslator(&relation, translator); let rewritten = ast::Query::from(rel_with_traslator); println!("Rewritten Query: \n{}", rewritten); + // execute _ = database .query(rewritten.to_string().as_str()) .unwrap() .iter() .map(ToString::to_string); + + // Try rebuilding the relation + let query_with_relation = QueryWithRelations::new(&rewritten, &relations); + let _relation = Relation::try_from((query_with_relation, translator))?; Ok(()) } }