[6.1, 7.0, trunk] Cannot create manual many2many fields on models with long table names
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
On manually created many2many fields, the cross table is composed as follows:
'x_' + target_model + '_' + source_model + '_' + field_name + '_rel'
Due to the relation length limit of 63 in Postgresql, you will run into trouble when both model names are a bit long. Although the table is created in that case with a truncated name, creating the indexes fails because these are created as
cross_table + '_' + column_name + '_index'
Because the relation name length limit applies equally to the index, the truncated index name is equal to the truncated cross table name which raises an exception like
File "/home/
cr.
File "/home/
return f(self, *args, **kwargs)
File "/home/
res = self._obj.
ProgrammingError: relation "x_magerp_