Problem/Motivation
Created an entity with the basetable name "group". Got MySQL error several times. However, my module was fully working. What i noticed is that the error comes from the entity annotation.
It is possible to create a table with MySQL when using prereserved names like group, with, in, select, .. if your SQL statment uses inverted comma. The annotation cannot handle this so the sql statement generator (i have no clue how D8 creates sql statments) should automatically do this.
Example:
Faulty D8 Annotation
/**
* Defines the select entity
*
* @ContentEntityType(
* id = "select_entity",
* label = @Translation("Selector"),
* base_table = "select",
* entity_keys = {
* "id" = "sid",
* },
* )
*/
SQL generates
CREATE TABLE select (ID int);
failsSQL should generateCREATE TABLE ´select´ (ID int);
works
Proposed resolution
For developer experience all table names should be available so D8 needs to create statements with inverted comma.
Remaining tasks
- Check for contra arguments
- Implement the new auto generation for statements