orm
orm copied to clipboard
Test suite incompatibility with MySQL 9.4: LIBRARY is a reserved word
Bug Report
| Q | A |
|---|---|
| Version | 2.2.x |
Summary
Apparently since MySQL 9.4 "LIBRARY" is a reserved SQL word, so the Library Enum in the test suite is causing an SQL error:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Library (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY (id)) DEFAULT CHARACTER SET' at line 1' while executing DDL: CREATE TABLE Library (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
I was about to send a PR, but TBH I'm not sure if the driver should manage quoting the table name in case it's a reserved word, or if the entity should simply use a different table name.
Current behavior
- Doctrine\Tests\ORM\Functional\EnumTest::testEnumCollectionMatchingOnOneToMany with data set #0 (Doctrine\Common\Collections\Expr\Comparison Object (...))
Doctrine\ORM\Tools\ToolsException: Schema-Tool failed with Error 'An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Library (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY (id)) DEFAULT CHARACTER SET' at line 1' while executing DDL: CREATE TABLE Library (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4 COLLATE
utf8mb4_unicode_ciENGINE = InnoDB
Expected behavior
Test(s) pass
How to reproduce
Run test suite with MySQL 9.4