Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.0
-
None
-
None
-
Tested with Postgresql
Description
Sqlbuilder shortens the names of columns and tables corresponding to the length found in PlatformInfo. When writing the column names in the References of the ForeignKeys this shortening is not applied. This leads to invalid foreignkeys when your column name was longer than the max size.
I have applied a fix locally in the source. This is what I changed in SqlBuilder class:
protected void writeForeignReferences(ForeignKey key) throws IOException
{
for (int idx = 0; idx < key.getReferenceCount(); idx++)
{
if (idx > 0)
// FIXME added this myself to prevent foreign keys references having too long columnname lenght
printIdentifier(shortenName(key.getReference(idx).getForeignColumnName(),getMaxColumnNameLength()));
}
}
/**
* Writes a list of local references for the given foreign key.
*
* @param key The foreign key
*/
protected void writeLocalReferences(ForeignKey key) throws IOException
{
for (int idx = 0; idx < key.getReferenceCount(); idx++)
{
if (idx > 0)
{ print(", "); }
// FIXME same
printIdentifier(shortenName(key.getReference(idx).getLocalColumnName(), getMaxColumnNameLength()));
}
}
Attachments
Issue Links
- relates to
-
DDLUTILS-279 SqlBuilder does not shorten the name of columns
- Open