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

Errors with input from multiple statements coming from stdin, .read, or CLI arg are unhelpful #148

Open
CodingDoug opened this issue Aug 15, 2023 · 0 comments

Comments

@CodingDoug
Copy link
Contributor

The observations here apply to input from all of these sources (not interactive commands):

  • stdin (pipe or redirect from a file)
  • .read command in the shell
  • CLI argument with the Turso shell

When a single statement is provided, the error message is helpful. For input select;, the error message is descriptive:

Error: failed to execute SQL: select;
SQL string could not be parsed: unexpected end of input at (1, 7)

However, when multiple statements are provided, the error message is not helpful. For input select; select:

Error: failed to execute SQL: select; select

Note that there are no diagnostics attached to the result.

The sqlite3 shell gives more usable output:

Parse error near line 1: near ";": syntax error
  select; select
        ^--- error here

Also problematic is the fact that the entire input is printed in the error message. If you use a lengthy SQL script as input, and there is an error anywhere during its execution, the output contains the entire script contents as above, with nothing indicating the problem. This makes long scripts extremely difficult to debug.

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