diff --git a/core/translate/planner.rs b/core/translate/planner.rs index aa21e8a34..77af53126 100644 --- a/core/translate/planner.rs +++ b/core/translate/planner.rs @@ -50,6 +50,14 @@ pub fn resolve_aggregates(top_level_expr: &Expr, aggs: &mut Vec) -> R { Ok(Func::Agg(f)) => { let distinctness = Distinctness::from_ast(distinctness.as_ref()); + #[cfg(not(feature = "index_experimental"))] + { + if distinctness.is_distinct() { + crate::bail_parse_error!( + "SELECT with DISTINCT is not allowed without indexes enabled" + ); + } + } let num_args = args.as_ref().map_or(0, |args| args.len()); if distinctness.is_distinct() && num_args != 1 { crate::bail_parse_error!( diff --git a/core/translate/select.rs b/core/translate/select.rs index 85469be64..bda9dabe2 100644 --- a/core/translate/select.rs +++ b/core/translate/select.rs @@ -202,6 +202,14 @@ fn prepare_one_select_plan<'a>( distinctness, .. } = *select_inner; + #[cfg(not(feature = "index_experimental"))] + { + if distinctness.is_some() { + crate::bail_parse_error!( + "SELECT with DISTINCT is not allowed without indexes enabled" + ); + } + } let col_count = columns.len(); if col_count == 0 { crate::bail_parse_error!("SELECT without columns is not allowed"); @@ -336,6 +344,15 @@ fn prepare_one_select_plan<'a>( 0 }; let distinctness = Distinctness::from_ast(distinctness.as_ref()); + + #[cfg(not(feature = "index_experimental"))] + { + if distinctness.is_distinct() { + crate::bail_parse_error!( + "SELECT with DISTINCT is not allowed without indexes enabled" + ); + } + } if distinctness.is_distinct() && args_count != 1 { crate::bail_parse_error!("DISTINCT aggregate functions must have exactly one argument"); }