From 7f91768ff686704658d70e1f2a7a1253936189a0 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Mon, 7 Jul 2025 10:02:40 +0300 Subject: [PATCH] core/translate: Unify no such table error messages We're now mixing different error messages, which makes compatibility testing pretty hard. Unify on a single, SQLite compatible error message "no such table". --- bindings/rust/src/lib.rs | 2 +- core/translate/planner.rs | 4 ++-- core/translate/select.rs | 2 +- testing/cli_tests/extensions.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bindings/rust/src/lib.rs b/bindings/rust/src/lib.rs index 465ca1ca9..006846f92 100644 --- a/bindings/rust/src/lib.rs +++ b/bindings/rust/src/lib.rs @@ -569,7 +569,7 @@ mod tests { Ok(_) => panic!("Query succeeded after WAL deletion and DB reopen, but was expected to fail because the table definition should have been in the WAL."), Err(Error::SqlExecutionFailure(msg)) => { assert!( - msg.contains("test_large_persistence not found"), + msg.contains("no such table: test_large_persistence"), "Expected 'test_large_persistence not found' error, but got: {}", msg ); diff --git a/core/translate/planner.rs b/core/translate/planner.rs index c4161f0de..56f51bc5c 100644 --- a/core/translate/planner.rs +++ b/core/translate/planner.rs @@ -208,7 +208,7 @@ pub fn bind_column_references( let matching_tbl = referenced_tables .find_table_and_internal_id_by_identifier(&normalized_table_name); if matching_tbl.is_none() { - crate::bail_parse_error!("Table {} not found", normalized_table_name); + crate::bail_parse_error!("no such table: {}", normalized_table_name); } let (tbl_id, tbl) = matching_tbl.unwrap(); let normalized_id = normalize_ident(id.0.as_str()); @@ -320,7 +320,7 @@ fn parse_from_clause_table( } } - crate::bail_parse_error!("Table {} not found", normalized_qualified_name); + crate::bail_parse_error!("no such table: {}", normalized_qualified_name); } ast::SelectTable::Select(subselect, maybe_alias) => { let Plan::Select(subplan) = prepare_select_plan( diff --git a/core/translate/select.rs b/core/translate/select.rs index 6d1ea6ceb..a6013a562 100644 --- a/core/translate/select.rs +++ b/core/translate/select.rs @@ -298,7 +298,7 @@ fn prepare_one_select_plan( .find(|t| t.identifier == name_normalized); if referenced_table.is_none() { - crate::bail_parse_error!("Table {} not found", name.0); + crate::bail_parse_error!("no such table: {}", name.0); } let table = referenced_table.unwrap(); let num_columns = table.columns().len(); diff --git a/testing/cli_tests/extensions.py b/testing/cli_tests/extensions.py index 1aa67feed..644a6a50b 100755 --- a/testing/cli_tests/extensions.py +++ b/testing/cli_tests/extensions.py @@ -662,7 +662,7 @@ def test_csv(): limbo.run_test_fn("DROP TABLE temp.csv;", null, "Drop CSV table") limbo.run_test_fn( "SELECT * FROM temp.csv;", - lambda res: "Parse error: Table csv not found" in res, + lambda res: "Parse error: no such table: csv" in res, "Query dropped CSV table should fail", ) limbo.run_test_fn(