Closed snelg closed 2 years ago
I was going to write up a clean "steps to reproduce", but it looks like two of the existing unit tests already trigger this error:
phpunit --filter testAssociationSubQueryNoOffset
and
phpunit --filter testPolymorphicBelongsToManySave
You saved my life with DB2! Thanks! :smiley:
Any news on this?
There is partial solution implemented in identifier_issue branch
cakePHP 4.0.2 added an helper in debug mode and now throw exception
ORM queries generate field aliases using the table name/alias and column name.
The table alias `{$table}` and column `{$name}` create an alias longer than ({$nameLength}).
You must change the table schema in the database and shorten either the table or column
identifier so they fit within the database alias limits.
The driver should add the max length
protected const MAX_ALIAS_LENGTH = 30;
merged
Oracle has a 30-character limit for identifiers, including aliases. Cake creates field aliases using the pattern "Tablealias__fieldname", which not infrequently results in more than 30 characters, especially in the legacy systems I deal with. I'd be more than happy to leave my own Cake 3 Oracle driver behind as a historical relic, but I can't switch to your much more robust driver without this issue being addressed somehow. I'm genuinely embarrassed to exhibit this code, but here's the quick-and-dirty workaround I did in my driver: https://github.com/snelg/cakephp-3-oracle/commit/e7feaa0b28de06faa148f1649f5486c79a5b2de4
So that's a general idea for one solution or, more likely, an example of what to avoid at all costs :)