Hi folks! Yesterday I did a lot of work on the DBDictionary Column name handling. I've experienced a few issues when running our test suite against MS SQLServer, and then found a few very old bugs in our issue tracker.
I probably gonna change the logic slightly once again to make it even more configurable. There is a list of reserved SQL keywords https://www.drupal.org/docs/develop/coding-standards/list-of-sql-reserved-words <https://www.drupal.org/docs/develop/coding-standards/list-of-sql-reserved-words> I fear this is not a perfect list, and many databases might be ok with a subset of it as column names. E.g. while TYPE is on the list of reserved words it is a perfectly valid column name in some databases. The new logic is as following: 1. load all the reserved standard keywords (old list we maintained ourselves in the past) from 'sql-keywords.rsrc'. This file is really old (initial checkin from Patrick, it was already part of KODO). In the old days this was only done in endConfiguration(). But this is way too late, as some DBDicts did use it as base for their invalidColumnWordSet. At the point this list was used it was always empty, leaving some DBDicts effectively without any reserved words. Thus I moved the sql-keywords.rsrc loading to the ct. 2. Some DBDictionaries do maintain their own list of both lists (reserved words and reserved column names), e.g. https://github.com/apache/openjpa/blob/aeb333fb3a6b7eb611c3ed79ba39c6286445f5b3/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java#L214 <https://github.com/apache/openjpa/blob/aeb333fb3a6b7eb611c3ed79ba39c6286445f5b3/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java#L214> Manually setting those will always take precedence over sql-keywords.rsrc and sql-invalid-column-names.rsrc loading (a new file I did introduce yesterday). The later will only be loaded if the database did not define any invalid column names. 3. I fixed ColumnDefIdentifierRule. It actually was never used it seems. And it in turn did not use the invalidColumnWordSet defined in the DBDictionary. This now works. I tried to be as sensible as positive, but it might mean that we gonna see some slight difference in column name generation. We also miss a list of really tested reserved column names. Probably we should do a test where we try to create all of them and then collect those to a file? Anyone here who likes to hack such a small tool? t could use the databases provided via our docker setup as documented here: https://github.com/apache/openjpa/blob/master/README.adoc#testing-against-different-databases <https://github.com/apache/openjpa/blob/master/README.adoc#testing-against-different-databases> LieGrue, strub