From 22e07aa603e0daed8d08fb099a15bc55b2c7ac99 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Sat, 29 Oct 2022 14:59:50 +0200 Subject: [PATCH] check if table name should be included in translate ident --- prql-compiler/src/sql/codegen.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/prql-compiler/src/sql/codegen.rs b/prql-compiler/src/sql/codegen.rs index 08d9ea612028..29a1ea492718 100644 --- a/prql-compiler/src/sql/codegen.rs +++ b/prql-compiler/src/sql/codegen.rs @@ -414,14 +414,17 @@ pub(super) fn translate_ident( context: &Context, ) -> Vec { let mut parts = Vec::with_capacity(4); - if let Some(relation) = relation_name { - // Special-case this for BigQuery, Ref #852 - if matches!(context.dialect.dialect(), Dialect::BigQuery) { - parts.push(relation); - } else { - parts.extend(relation.split('.').map(|s| s.to_string())); + if !context.omit_ident_prefix || column.is_none() { + if let Some(relation) = relation_name { + // Special-case this for BigQuery, Ref #852 + if matches!(context.dialect.dialect(), Dialect::BigQuery) { + parts.push(relation); + } else { + parts.extend(relation.split('.').map(|s| s.to_string())); + } } } + parts.extend(column); parts