You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Pierre Smits (Jira)" <ji...@apache.org> on 2021/10/07 14:23:00 UTC

[jira] [Created] (OFBIZ-12334) OFBiz rejects table and index names

Pierre Smits created OFBIZ-12334:
------------------------------------

             Summary: OFBiz rejects table and index names
                 Key: OFBIZ-12334
                 URL: https://issues.apache.org/jira/browse/OFBIZ-12334
             Project: OFBiz
          Issue Type: Bug
          Components: framework/entity
    Affects Versions: Trunk
            Reporter: Pierre Smits


Currently, the entity engine checks (amounts others) validity aspects of table names, index names and column names. 
This is done in the ModelEntityChecker.java file

One of the aspects to check is length of the (generated) name based on definitions in the entitymodel file.

An example is:
{code:java}
if (field.getColName().length() > 30 && !(entity instanceof ModelViewEntity)) {
    warningList.add("[FieldNameGT30] Column name [" + field.getColName() + "] of entity " + entity.getEntityName() + " is longer than 30 characters.");
                    }
{code}
As can be seen in the example the limit is set at 30 characters.

Because such limits are hard coded, and not in sync with requirements of modern day production grade database (but rather based on the limitations of Apache Derby way back when see [1]), creation of tables, indexes and columns exceeding those Derby limitations leads to errors in databases like mysql (see [2]) and postgresql (see [3])

[1] [https://db.apache.org/derby/docs/10.0/manuals/reference/sqlj268.html]

[2] [https://dev.mysql.com/doc/refman/8.0/en/identifier-length.htmll|https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html]

[3] https://til.hashrocket.com/posts/8f87c65a0a-postgresqls-max-identifier-length-is-63-bytes

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)