diff --git a/core/translate/planner.rs b/core/translate/planner.rs index f659d1a23..f72963234 100644 --- a/core/translate/planner.rs +++ b/core/translate/planner.rs @@ -212,7 +212,7 @@ pub fn bind_column_references( Ok(()) } else { // Unquoted identifiers must resolve to columns - no fallback - crate::bail_parse_error!("Column {} not found", id.as_str()) + crate::bail_parse_error!("no such column: {}", id.as_str()) } } Expr::Qualified(tbl, id) => { @@ -236,7 +236,7 @@ pub fn bind_column_references( .is_some_and(|name| name.eq_ignore_ascii_case(&normalized_id)) }); let Some(col_idx) = col_idx else { - crate::bail_parse_error!("Column {} not found", normalized_id); + crate::bail_parse_error!("no such column: {}", normalized_id); }; let col = tbl.columns().get(col_idx).unwrap(); *expr = Expr::Column { diff --git a/core/translate/update.rs b/core/translate/update.rs index f3636cadc..80d958f82 100644 --- a/core/translate/update.rs +++ b/core/translate/update.rs @@ -159,10 +159,10 @@ pub fn prepare_update_plan( for set in &mut body.sets { let ident = normalize_ident(set.col_names[0].as_str()); let Some(col_index) = column_lookup.get(&ident) else { - bail_parse_error!("Parse error: no such column: {}", ident); + bail_parse_error!("no such column: {}", ident); }; - let _ = bind_column_references(&mut set.expr, &mut table_references, None, connection); + bind_column_references(&mut set.expr, &mut table_references, None, connection)?; if let Some(idx) = set_clauses.iter().position(|(idx, _)| *idx == *col_index) { set_clauses[idx].1 = set.expr.clone(); diff --git a/testing/cli_tests/extensions.py b/testing/cli_tests/extensions.py index b145fb40a..11c9607f8 100755 --- a/testing/cli_tests/extensions.py +++ b/testing/cli_tests/extensions.py @@ -726,7 +726,7 @@ def test_csv(): ) limbo.run_test_fn( "SELECT c1 FROM t1;", - lambda res: "Parse error: Column c1 not found" in res, + lambda res: "Parse error: no such column: c1" in res, "Empty CSV table without header should not have columns other than 'c0'", ) @@ -738,7 +738,7 @@ def test_csv(): ) limbo.run_test_fn( "SELECT c0 FROM t2;", - lambda res: "Parse error: Column c0 not found" in res, + lambda res: "Parse error: no such column: c0" in res, "Empty CSV table with header should not have columns other than '(NULL)'", ) diff --git a/testing/update.test b/testing/update.test index 8c225aba1..f0488678a 100755 --- a/testing/update.test +++ b/testing/update.test @@ -269,4 +269,9 @@ do_execsql_test_on_specific_db {:memory:} update-single-rowid { INSERT INTO t VALUES (1); UPDATE t SET x = 2 WHERE x = 1; SELECT * FROM t; -} {2} \ No newline at end of file +} {2} + +do_execsql_test_in_memory_error_content update-set-expression-missing-identifier { + CREATE TABLE t0 (c0 INT); + UPDATE t0 SET c0 = 1, c0 = c1; +} {".*no such column: c1.*"}