From 433f5a52b152deb7acf149eabfece91edcbf674c Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Thu, 25 Sep 2025 16:30:34 +0300 Subject: [PATCH] Disallow ORDER BY and LIMIT in a non-compound VALUES() --- core/translate/select.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/translate/select.rs b/core/translate/select.rs index b35b16014..3b305ba12 100644 --- a/core/translate/select.rs +++ b/core/translate/select.rs @@ -519,6 +519,12 @@ fn prepare_one_select_plan( Ok(plan) } ast::OneSelect::Values(values) => { + if !order_by.is_empty() { + crate::bail_parse_error!("ORDER BY clause is not allowed with VALUES clause"); + } + if limit.is_some() { + crate::bail_parse_error!("LIMIT clause is not allowed with VALUES clause"); + } let len = values[0].len(); let mut result_columns = Vec::with_capacity(len); for i in 0..len {