[
https://issues.apache.org/jira/browse/OPENJPA-2182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17311715#comment-17311715
]
Enrico Olivelli commented on OPENJPA-2182:
------------------------------------------
This is interesting.
In fact in HerdDB, that uses Calcite, I ended up in adding delimiters
everywhere, because I didn't find a way to make reserved words delimitation work
> DB dictionaries do not properly process reserved words for column names
> -----------------------------------------------------------------------
>
> Key: OPENJPA-2182
> URL: https://issues.apache.org/jira/browse/OPENJPA-2182
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 2.3.0
> Environment: Sybase, SQL Server
> Reporter: Jeremy Bauer
> Assignee: Mark Struberg
> Priority: Major
>
> OpenJPA maintains a set of SQL reserved words in the file sql-keywords.rsrc.
> In addition to the reserved words in this file, each db dictionary can append
> its own set of reserved words. In addition, each dictionary maintains a set
> of values that are considered invalid column names. It uses this set to
> avoid the use of these names during mapping. I recently discovered that the
> Sybase and SQLServer dictionaries are not populating the invalid column names
> set with the SQL reserved words. Only the dictionary specific names are
> being added. The invalid column words set is being populated when the DB
> dictionary is constructed. That occurs before the SQL reserved words are
> loaded by DBDictionary.endConfiguration(). Thus, the SQL reserved words are
> not added.
> I discovered this issue when using the field name "level" in one of my
> entities. This caused a build failure on Sybase. However, the
> AbstractSQLServerDictionary contains the same (flawed) logic as Sybase and it
> did not flag "level" as a keyword. This says that we can't blindly add all
> the SQL keywords in sql-keywords.rsrc to the invalid columns list as the
> logic suggests. For now, I'm just fixing the testcase to avoid this
> condition. I fear that making a code change without extensive testing will
> cause regression for those happily running on the affected platforms.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)