SQL parse errors difficult to understand
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 ")"
@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,
}
Yeah, breaking out all that data would make it easier for clients to format their own error messages.