mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-31 05:44:25 +01:00
Fix another "should have been rewritten" translation panic
Closes #2158
This commit is contained in:
@@ -505,7 +505,7 @@ fn prepare_one_select_plan(
|
||||
// Return the unoptimized query plan
|
||||
Ok(plan)
|
||||
}
|
||||
ast::OneSelect::Values(values) => {
|
||||
ast::OneSelect::Values(mut values) => {
|
||||
if !order_by.is_empty() {
|
||||
crate::bail_parse_error!("ORDER BY clause is not allowed with VALUES clause");
|
||||
}
|
||||
@@ -522,6 +522,21 @@ fn prepare_one_select_plan(
|
||||
contains_aggregates: false,
|
||||
});
|
||||
}
|
||||
|
||||
for value_row in values.iter_mut() {
|
||||
for value in value_row.iter_mut() {
|
||||
bind_and_rewrite_expr(
|
||||
value,
|
||||
None,
|
||||
None,
|
||||
connection,
|
||||
&mut program.param_ctx,
|
||||
// Allow sqlite quirk of inserting "double-quoted" literals (which our AST maps as identifiers)
|
||||
BindingBehavior::AllowUnboundIdentifiers,
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
let plan = SelectPlan {
|
||||
join_order: vec![],
|
||||
table_references: TableReferences::new(vec![], vec![]),
|
||||
|
||||
@@ -48,3 +48,16 @@ do_execsql_test_skip_lines_on_specific_db 1 {:memory:} values-double-quotes-subq
|
||||
.dbconfig dqs_dml on
|
||||
SELECT * FROM (VALUES ("subquery_string"));
|
||||
} {subquery_string}
|
||||
|
||||
# regression test for: https://github.com/tursodatabase/turso/issues/2158
|
||||
do_execsql_test_on_specific_db {:memory:} values-between {
|
||||
CREATE TABLE t0 (c0);
|
||||
INSERT INTO t0 VALUES ((0 BETWEEN 0 AND 0)), (0);
|
||||
SELECT * FROM t0;
|
||||
} {1
|
||||
0}
|
||||
|
||||
do_execsql_test_in_memory_any_error values-illegal-column-ref {
|
||||
CREATE TABLE t0 (c0);
|
||||
INSERT INTO t0 VALUES (c0);
|
||||
}
|
||||
Reference in New Issue
Block a user