Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions prqlc/prqlc/src/sql/dialect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,6 @@ impl DialectHandler for PostgresDialect {
}

impl DialectHandler for RedshiftDialect {
fn ident_quoting_style(&self) -> IdentQuotingStyle {
// Use conditional quoting with dialect-specific keywords
IdentQuotingStyle::ConditionallyQuoted
}

fn interval_quoting_style(&self, dtf: &DateTimeField) -> IntervalQuotingStyle {
if matches!(dtf, DateTimeField::Week(_) | DateTimeField::Weeks) {
IntervalQuotingStyle::ValueAndUnitQuoted
Expand All @@ -375,10 +370,6 @@ impl DialectHandler for RedshiftDialect {
}
}

fn supports_distinct_on(&self) -> bool {
false
}

// https://docs.aws.amazon.com/redshift/latest/dg/r_FORMAT_strings.html
fn translate_chrono_item(&self, item: Item) -> Result<String> {
Ok(match item {
Expand Down
37 changes: 4 additions & 33 deletions prqlc/prqlc/src/sql/gen_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ fn translate_set_ops_pipeline(
}

fn translate_relation_expr(relation_expr: RelationExpr, ctx: &mut Context) -> Result<TableFactor> {
let alias = Some(&relation_expr.riid)
.and_then(|riid| ctx.anchor.relation_instances.get(riid))
let alias = (ctx.anchor.relation_instances.get(&relation_expr.riid))
.and_then(|ri| ri.table_ref.name.clone());

Ok(match relation_expr.kind {
Expand Down Expand Up @@ -448,40 +447,12 @@ fn translate_cte(cte: Cte, ctx: &mut Context) -> Result<(sql_ast::Cte, bool)> {
right: step,
});

(inner_query, true)

// RECURSIVE can only follow WITH directly.
// Initial implementation assumed that it applies only to the first CTE.
// This meant that it had to wrap any-non-first CTE into a *nested* WITH, so the inner
// WITH could be RECURSIVE.
// This is implementation of that, in case some dialect requires it.
// let inner_cte = sql_ast::Cte {
// alias: simple_table_alias(cte_name.clone()),
// query: Box::new(inner_query),
// from: None,
// };
// let outer_query = sql_ast::Query {
// with: Some(sql_ast::With {
// recursive: true,
// cte_tables: vec![inner_cte],
// }),
// ..default_query(sql_ast::SetExpr::Select(Box::new(sql_ast::Select {
// projection: vec![SelectItem::Wildcard(
// sql_ast::WildcardAdditionalOptions::default(),
// )],
// from: vec![TableWithJoins {
// relation: TableFactor::Table {
// name: sql_ast::ObjectName(vec![cte_name.clone()]),
// alias: None,
// args: None,
// with_hints: Vec::new(),
// },
// joins: vec![],
// }],
// ..default_select()
// })))
// };
// (outer_query, false)
// WITH could be RECURSIVE. If a dialect ever needs that, the removed implementation is
// in the history of this file (deleted in #6190).
(inner_query, true)
}
};

Expand Down
Loading