-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added to quote all the keywords for PostgreSQL. List from https://www… #551
Conversation
Thank you for PR, but as I can see from a Could you actualize |
Did a diff between SQL2003-2 vs PostgreSQL 11 (https://www.postgresql.org/docs/current/sql-keywords-appendix.html) and got the below. Still a few, but much less. Side Note: It does solve the problem that is affecting me, ie. "desc". What do you think? Actually, am I right to say that the DatabaseMetaData.getSqlKeywords should have given the most complete and accurate list? All this that you are having to do is because that feature is broken there? Or am I missing something?
|
After update of SQL2003 keywords list I've got (using your test example) such list of words: But some of them (like superuser) is absent from Postgres doc table, other (ignore, iterate) is non-reserved in PostgreSQL. What do you think? |
superuser is listed as a keyword in 8.1, but not in postgresql 11, it seems version to version it is different too... thinking out loud... (1) rely entirely on databasemetadata.sqlKeywords? But that also means we should go find out why it is missing so many keywords, or (2) quote all instead of quoting only keywords? what do you think? |
@boonshift , as I can see from a PG jdbc driver, starting from PostegreSQL 9 there is bundled list of keywords and driver retrieves them right from database: // Exclude SQL:2003 keywords (https://github.com/ronsavage/SQL/blob/master/sql-2003-2.bnf)
// from the returned list, ugly but required by jdbc spec.
String sql = "select string_agg(word, ',') from pg_catalog.pg_get_keywords() " So I assume that it's worth to just update ANSI_SQL_2003_KEYWORDS in Exposed and it will cover most of the cases. |
Cool. Then shall we merge this PR in then? It is now basically updated with ANSI_SQL_2003_KEYWORDS. Thanks! |
….postgresql.org/docs/8.1/sql-keywords-appendix.html
Original problem: I added a column "desc", when inserting data, desc was not quoted and failed.
I ran some code locally,
and I got a lot of missing keywords...
Not sure why postgresql is returning so few keywords via metadata.