Relationship Name can get too long
Last week we ran into a problem with a relation name in 1.9.5.0. We had created a relation which had a very long name (because the structures had long names). This was no problem, but every time we tried to save content that used this relation, we got an error in the log (dotCMS gave no error). It said that it couldn't save the field in Tree or Treemap since the name was too long.
This is a minor bug. Adding some validation to the length of the relationship name will solve this problem.
If you try to create one that is more than 255 characters it will fail because of the db field size limit. However, you can create a relationship with a long enough name, but not longer than the db limit of 255, that will cause content not to be able to be saved for the related structures. I think the issue is the length of the relation_type field in the tree table.
We should either not allow relationships to created with such a long name (since you can change the name anyway in the creation) with some simple validation, or we should fix the bug preventing the content from saving.
Here is the error in the log as tested with 2.0 on the demo site: https://gist.github.com/2576529
To recreate:
- Create 2 structures with following names and give them one text field each:
- A Structure with a Really Really Really Really Really Really Really Really Really Really Really Really Really Really Really Really Really Really Really Really Long Name
- Another Structure with not so long a name (The idea being that together the names are not longer than 255 characters)
- Relate the 2 structures
- Create one contentlet each and then try to relate the 2 contentlets
Here is a screencast of me showing how to reproduce the issue: http://screencast.com/t/1BmgRozreK
For now lets use some JS to limit the input and handle in the API to reject the input and not try to goto the DB
We need to use a camelCased version of the releationship without _Parent and _Child