Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

SQL parse errors difficult to understand #459

Open
CodingDoug opened this issue Jun 5, 2023 · 2 comments
Open

SQL parse errors difficult to understand #459

CodingDoug opened this issue Jun 5, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@CodingDoug
Copy link
Contributor

A few examples:

select * from table_name,;

SQL string could not be parsed: near SEMI, "None": syntax error at (1, 27)

create table table_name (
    text_ text,
);

SQL string could not be parsed: near RP, "None": syntax error at (3, 2)

In all cases, the "None" doesn't seem to be helpful at all. Maybe that's a rust string format thing.

I'm not really sure what information we have at our disposal to improve this. The sqlite3 CLI:

  • Shows surrounding text
  • Points an arrow at the location of the parse error
  • Converts symbols like "RP" to ")"
@MarinPostma
Copy link
Collaborator

MarinPostma commented Jun 8, 2023

@CodingDoug, I agree this should be improved. I'm not sure showing text is going to be helpful without proper formatting, but we could return a machine-readable error object:

type ParseError = {
    line: int,
    char: int,
    message: string,
}

@MarinPostma MarinPostma added enhancement New feature or request good first issue Good for newcomers labels Jun 8, 2023
@CodingDoug
Copy link
Contributor Author

Yeah, breaking out all that data would make it easier for clients to format their own error messages.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants