Skip to content

Commit 1acc4eb

Browse files
committed
Improve error message when non-SELECT statement is used.
1 parent e3b5fe0 commit 1acc4eb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/root.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ octosql "SELECT * FROM plugins.plugins"`,
229229
if err != nil {
230230
return fmt.Errorf("couldn't parse query: %w", err)
231231
}
232-
logicalPlan, outputOptions, err := parser.ParseNode(statement.(sqlparser.SelectStatement))
232+
selectStmt, ok := statement.(sqlparser.SelectStatement)
233+
if !ok {
234+
return fmt.Errorf("only SELECT statements are supported")
235+
}
236+
logicalPlan, outputOptions, err := parser.ParseNode(selectStmt)
233237
if err != nil {
234238
return fmt.Errorf("couldn't parse query: %w", err)
235239
}

0 commit comments

Comments
 (0)