JSqlParser
JSqlParser copied to clipboard
[FEATURE] allow RDBMS specific keywords as columns
Grammar or Syntax Description
- Postgresql allows some keywords as column names (i.e.
start)
SQL Example
- Simplified Query Example, focusing on the failing feature
SELECT 'Monday' AS start
Currently, I get a parse error.
Was expecting one of:
"::"
"^"
<EOF>
<ST_SEMICOLON>
I do not really consider this as bug, as I can understand that by default when making a generic sql parser you want to follow the standard keywords strictly. However, Postgres is a bit more lenient: https://www.postgresql.org/docs/current/sql-keywords-appendix.html
It would be nice if this is configurate / a Feature ?
I know :)
The feature request is to allow some keywords to be 'white-listed'. I can't quote all my 10.000+ scripts by hand (I'd need a parser for that to do that effectively...)
Ok. I know, it will be a subset of those scripts, and I can grep 'start' so it will be a lot less but still annoying. Would be nice if Postgres was stricter so the ppl here would not use these keywords unquoted.
Greetings!
You will have to edit the keyword definitions in the Grammar and change the keyword classification/restriction there. Then run the "Update keywords" task as described here: https://manticore-projects.com/JSQLParser/contribution.html#manage-reserved-keywords and then run the standard test suite. If all tests succeed we can merge your relaxed keywords and your PR will be welcome.
Although "START" is a reserved keyword in SQL:2016 and should be avoided in my opinion.
Ah I have to build a custom jar for sql parser then. Makes sense (and I totally agree with sticking to the standard, it is unfortunate that we already have such a large mass of non-standard scripts)
No custom jar needed. Just send a PR when you have relaxed the keyword definition and we merge it into master.On 30 Aug 2024 09:20, Rob Audenaerde @.***> wrote: Ah I have to build a custom jar for sql parser then. Makes sense (and I totally agree with sticking to the standard, it is unfortunate that we already have such a large mass of non-standard scripts)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Greetings,
I have tried to allow "START", but the grammar will break and not compile ("unreachable statement"). There is no easy way to fix it, but of course any PRs improving the situation would be welcome.