Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate errors up when columns aren't found #167

Open
jonhoo opened this issue Jul 8, 2020 · 0 comments
Open

Propagate errors up when columns aren't found #167

jonhoo opened this issue Jul 8, 2020 · 0 comments

Comments

@jonhoo
Copy link
Contributor

jonhoo commented Jul 8, 2020

Try installing this recipe:

CREATE TABLE Article (id int, title varchar(255), PRIMARY KEY(id));
CREATE TABLE Vote (article_id int, user int);
CREATE VIEW VoteCount AS SELECT Vote.article_id, COUNT(user) AS votes FROM Vote GROUP BY Vote.article_id;
QUERY ArticleWithVoteCount: SELECT VoteCount.id, VoteCount.votes AS votes FROM VoteCount WHERE VoteCount.id = ?;

You'll see the server crash with this error:

thread 'worker' panicked at 'tried to look up non-existent column Column { table: Some("VoteCount"), name: "id", function: None, aliases: [] } on node "VoteCount" (columns: [Column { table: Some("VoteCount"), name: "article_id", function: None, aliases: [] }, Column { table: Some("VoteCount"), name: "votes", function: None, aliases: [] }])', server/mir/src/node.rs:283:29
  13: noria_mir::node::MirNode::column_id_for_column
             at server/mir/src/node.rs:0
  14: noria_mir::node::MirNode::column_id_for_column
             at server/mir/src/node.rs:237
  15: noria_server::controller::mir_to_flow::make_project_node::{{closure}}
             at server/src/controller/mir_to_flow.rs:799
  24: noria_server::controller::mir_to_flow::make_project_node
             at server/src/controller/mir_to_flow.rs:797
  25: noria_server::controller::mir_to_flow::mir_node_to_flow_parts
             at server/src/controller/mir_to_flow.rs:255
  26: noria_server::controller::mir_to_flow::mir_query_to_flow_parts
             at server/src/controller/mir_to_flow.rs:38
  27: noria_server::controller::sql::SqlIncorporator::add_query_via_mir
             at server/src/controller/sql/mod.rs:561
  28: noria_server::controller::sql::SqlIncorporator::add_select_query
             at server/src/controller/sql/mod.rs:508
  29: noria_server::controller::sql::SqlIncorporator::nodes_for_named_query
             at server/src/controller/sql/mod.rs:905
  30: noria_server::controller::sql::SqlIncorporator::add_parsed_query
             at server/src/controller/sql/mod.rs:151
  31: noria_server::controller::recipe::Recipe::activate
             at server/src/controller/recipe/mod.rs:458
  32: noria_server::controller::inner::ControllerInner::apply_recipe::{{closure}}
             at server/src/controller/inner.rs:1011
  33: noria_server::controller::inner::ControllerInner::migrate
             at server/src/controller/inner.rs:688
  34: noria_server::controller::inner::ControllerInner::apply_recipe
             at server/src/controller/inner.rs:1010
  35: noria_server::controller::inner::ControllerInner::install_recipe
             at ./server/src/controller/inner.rs:1115
  36: noria_server::controller::inner::ControllerInner::external_request::{{closure}}
             at ./server/src/controller/inner.rs:277

This should instead be communicated as an error to the client who tried to install that recipe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant