You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parser: several E2002 errors pass hint text as the SQL source, printing a bogus context snippet #616
Several goerrors.ExpectedTokenError(...) calls in the parser pass a human-readable hint string as the sql argument. The error context then shows that sentence as "line 1" of the query, with the caret at the real column. #585 fixed this for qualifier errors only.
Reproduction
_, err:=gosqlx.Parse("SELECT a FROM t WHERE ) ")
fmt.Println(err)
gosqlx: syntax error: Error E2002 at line 1, column 23: expected expression after WHERE, got RPAREN
1 | WHERE clause requires a boolean expression
^^^^^^
Hint: expected expression after WHERE here
Expected: the context line shows the actual SQL (SELECT a FROM t WHERE ) ), and the explanatory sentence goes in the hint or message.
Suggested direction: pass the parser's source SQL (or "" when it is not available), and move the sentence into .WithHint(...). A grep for ExpectedTokenError( with a capitalized sentence as the fourth argument finds these call sites.
Activity
fix(parser): stop passing hint text as the SQL source in E2002/E2004 …
fix(parser): address adversarial review follow-ups for #627