mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
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".
This commit is contained in:
parent
99a23330a5
commit
7f91768ff6
4 changed files with 5 additions and 5 deletions
|
@ -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."),
|
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)) => {
|
Err(Error::SqlExecutionFailure(msg)) => {
|
||||||
assert!(
|
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: {}",
|
"Expected 'test_large_persistence not found' error, but got: {}",
|
||||||
msg
|
msg
|
||||||
);
|
);
|
||||||
|
|
|
@ -208,7 +208,7 @@ pub fn bind_column_references(
|
||||||
let matching_tbl = referenced_tables
|
let matching_tbl = referenced_tables
|
||||||
.find_table_and_internal_id_by_identifier(&normalized_table_name);
|
.find_table_and_internal_id_by_identifier(&normalized_table_name);
|
||||||
if matching_tbl.is_none() {
|
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 (tbl_id, tbl) = matching_tbl.unwrap();
|
||||||
let normalized_id = normalize_ident(id.0.as_str());
|
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) => {
|
ast::SelectTable::Select(subselect, maybe_alias) => {
|
||||||
let Plan::Select(subplan) = prepare_select_plan(
|
let Plan::Select(subplan) = prepare_select_plan(
|
||||||
|
|
|
@ -298,7 +298,7 @@ fn prepare_one_select_plan(
|
||||||
.find(|t| t.identifier == name_normalized);
|
.find(|t| t.identifier == name_normalized);
|
||||||
|
|
||||||
if referenced_table.is_none() {
|
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 table = referenced_table.unwrap();
|
||||||
let num_columns = table.columns().len();
|
let num_columns = table.columns().len();
|
||||||
|
|
|
@ -662,7 +662,7 @@ def test_csv():
|
||||||
limbo.run_test_fn("DROP TABLE temp.csv;", null, "Drop CSV table")
|
limbo.run_test_fn("DROP TABLE temp.csv;", null, "Drop CSV table")
|
||||||
limbo.run_test_fn(
|
limbo.run_test_fn(
|
||||||
"SELECT * FROM temp.csv;",
|
"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",
|
"Query dropped CSV table should fail",
|
||||||
)
|
)
|
||||||
limbo.run_test_fn(
|
limbo.run_test_fn(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue