Skip to content

Error in custom sql order by only when where clause present #1480

Answered by msujew
brsanthu asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @brsanthu,

you're basically hitting an issue in our parser implementation. Mainly, a WhereExpr can be followed by any other amount of WhereExpr. Since order is handled as a Name, it will think that there's a new WhereExpr starting. While there's a fix that includes rewriting the grammar to lift different rules to the same level, note that this isn't valid SQL syntax, as multiple WhereExpr should be separated by AND or OR. You should adjust your grammar. See also langium-sql for a mostly complete implementation of DQL. That should fix the issue by itself.

Also note that SQL forbids keywords as identifiers, you should use string escaping instead (also implemented in langium-sql).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@brsanthu
Comment options

@msujew
Comment options

Answer selected by brsanthu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants