[
https://issues.apache.org/jira/browse/OFBIZ-12334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pierre Smits updated OFBIZ-12334:
---------------------------------
Description:
Currently, the entity engine checks (amongst 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]
was:
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
> 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
> Priority: Major
>
> Currently, the entity engine checks (amongst 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)