Skip to content

Commit

Permalink
Improve error message when non-SELECT statement is used.
Browse files Browse the repository at this point in the history
  • Loading branch information
cube2222 committed Sep 25, 2022
1 parent e3b5fe0 commit 1acc4eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ octosql "SELECT * FROM plugins.plugins"`,
if err != nil {
return fmt.Errorf("couldn't parse query: %w", err)
}
logicalPlan, outputOptions, err := parser.ParseNode(statement.(sqlparser.SelectStatement))
selectStmt, ok := statement.(sqlparser.SelectStatement)
if !ok {
return fmt.Errorf("only SELECT statements are supported")
}
logicalPlan, outputOptions, err := parser.ParseNode(selectStmt)
if err != nil {
return fmt.Errorf("couldn't parse query: %w", err)
}
Expand Down

0 comments on commit 1acc4eb

Please sign in to comment.