[
https://issues.apache.org/jira/browse/OPENJPA-3074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18143614#comment-18143614
]
ASF subversion and git services commented on OPENJPA-3074:
----------------------------------------------------------
Commit dc7396e814ceec5b55c8feb4ca4dd39ae7922673 in openjpa's branch
refs/heads/OPENJPA-3075 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=dc7396e81 ]
[OPENJPA-3074] Share the common code of MySQLDictionary and MariaDBDictionary
in a superclass and add the MySQL 8 reserved words (#302)
* [OPENJPA-3074] Move the code MySQLDictionary and MariaDBDictionary share into
AbstractMySQLDictionary
* [OPENJPA-3074] Test that MySQLDictionary and MariaDBDictionary keep their
defaults
* [OPENJPA-3074] Treat the words that MySQL 8.0 and later reserve as invalid
column names
* [OPENJPA-3074] Add the issue to the release notes
* [OPENJPA-3074] Treat the words that MySQL 8.0 and later reserve as reserved
words for table names too
Table names are checked against the reserved words, not the invalid column
words, so an entity named Window or Function still failed to be created on
MySQL 8.0. MySQLDictionary delimits reserved words, so such a table or
column name is now delimited and keeps its name; MariaDBDictionary appends
a 0 to a column name as before. UpdatedMySQLReservedWords=false removes the
added reserved words again.
* [OPENJPA-3074] Test the version dependent settings of MySQLDictionary
The temporal types with a fraction of a second from MySQL 5.7, XML columns
from 5.1, the subselect flags before 4.1, the product version of a driver
that is not JDBC 3 compliant and the blob deserialization of a driver
before Connector/J 5.
* [OPENJPA-3074] Add the missing braces and replace the tabs in the error
handling of MySQLDictionary and MariaDBDictionary
* [OPENJPA-3074] Rename the compatibility option UpdatedMySQLReservedWords to
UpdatedMySQLAndMariaDBReservedWords, since it covers the reserved words of
MariaDB too
* [OPENJPA-3074] Delimit reserved words on MariaDB as on MySQL
MariaDBDictionary appended a 0 to a table or column name that is a reserved
word, so that an entity named Linear or Order got a table LINEAR0 or ORDER0,
and a name given explicitly in @Column was changed as well, while
MySQLDictionary delimits such a name and keeps it. The rule that delimits the
reserved words moves to AbstractMySQLDictionary, and MariaDBDictionary uses
it too. UpdatedMySQLAndMariaDBReservedWords=false restores the earlier names
on MariaDB.
* [OPENJPA-3074] Take the reserved words of MySQL and MariaDB from the servers
The words that the generated lists of invalid column words have, and that
MySQL 8.4 and 9.7 or MariaDB 10.11 and 12.3 reserve in a table name too, such
as NTILE, DUAL, KEYS or LIMIT, were missing from the reserved words, so that
a table named after one of them was neither delimited nor renamed and could
not be created. They are reserved words now, and an existing column such as
LIMIT0 becomes a delimited LIMIT. MariaDBDictionary also gets the words that
only MariaDB reserves, such as OFFSET, RETURNING or PORTION, and the names of
the built-in functions, such as NTILE, RANK or NOW, that MariaDB reserves in a
table name under the IGNORE_SPACE SQL mode, which MariaDB Connector/J sets.
All of them are removed again by UpdatedMySQLAndMariaDBReservedWords=false.
* [OPENJPA-3074] Test tables and columns named after words that MySQL or
MariaDB reserve
TestMySQLReservedWordColumns gets the entities Linear, Dual and Ntile, whose
table and column names are words that MySQL and MariaDB, only MariaDB or only
MySQL reserve. It runs on MySQL and MariaDB only, since Derby rejects a table
named Window.
* [OPENJPA-3074] Describe the reserved words and the delimiting on MySQL and
MariaDB in the migration considerations, the release notes and the
compatibility option
The section on the names that MySQL 8.0 and later reserve now covers MariaDB:
the words taken from the servers, the delimiting that MariaDB gets, what
changes for a schema an earlier release created, including the case of a
delimited table name, what UpdatedMySQLAndMariaDBReservedWords=false restores
on each database, and that the delimiting rule is shared by all persistence
units of the JVM.
* [OPENJPA-3074] Put back the delimiting of reserved words after the unit tests
that configure a MySQL or MariaDB dictionary
A configured MySQL or MariaDB dictionary makes the identifier rule that all
dictionaries of the JVM share delimit its reserved words, so that a later
test, such as TestDBIdentifiers, saw its names delimited.
* [OPENJPA-3074] Test that the names built from a delimited name, such as a
default join table, are delimited too
* [OPENJPA-3074] Say that the names built from a reserved word change too and
that the compatibility option restores the names generated before this change,
not all of 4.1.x
* [OPENJPA-3074] Say that MariaDB 10.11 does not know ST_COLLECT yet
* [OPENJPA-3074] Set the reserved words of the shared identifier rule before
switching the delimiting on, and publish both to other threads
* [OPENJPA-3074] Rename the compatibility option to UpdatedReservedWords and
leave the database specific details to the dictionaries
> Share the common code of MySQLDictionary and MariaDBDictionary in a
> superclass and add the MySQL 8 reserved words
> -----------------------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-3074
> URL: https://issues.apache.org/jira/browse/OPENJPA-3074
> Project: OpenJPA
> Issue Type: Improvement
> Reporter: Richard Zowalla
> Assignee: Richard Zowalla
> Priority: Major
> Fix For: 4.2.0
>
>
> MySQLDictionary and MariaDBDictionary both extend DBDictionary and duplicate
> most of their code, as noted in the review of #297 (OPENJPA-2943). Move the
> shared code into a common abstract superclass and keep the per-database
> differences and defaults in the two subclasses. All public configuration
> fields stay as they are.
> MySQLDictionary also lacks the reserved words MySQL 8.0 added, such as RANK,
> ROW_NUMBER, WINDOW and LATERAL. An entity attribute named rank therefore
> produces a CREATE TABLE statement that fails on MySQL 8.4 and 9.x.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)