Aliases truncated to 64 characters on Postgres
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
With a large join or long table names, postgres will truncate the aliases of the tables to 64 characters resulting in duplicate table names on the query. This makes the query unexecutable.
One solution is to shorten long alias names. I wrote something that modifies the alias when it is produced in db/models/query.py, but unfortunately, the join conditions get the alias as well, so the change will probably have to ultimately go into the SortedDict class to truncate and make the names unique in 64 characters there.
An alternate solution would be to prefix the aliases with incrementing numbers since the truncation will still preserve unique names for the aliases.