You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by "Damien Trog (JIRA)" <ji...@apache.org> on 2009/01/17 17:39:59 UTC
[jira] Created: (DDLUTILS-237) SqlBuilder does not shorten the name
of columns in references in foreignkeys
SqlBuilder does not shorten the name of columns in references in foreignkeys
----------------------------------------------------------------------------
Key: DDLUTILS-237
URL: https://issues.apache.org/jira/browse/DDLUTILS-237
Project: DdlUtils
Issue Type: Bug
Components: Core (No specific database)
Affects Versions: 1.0
Environment: Tested with Postgresql
Reporter: Damien Trog
Assignee: Thomas Dudziak
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)
{
print(", ");
}
// 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()));
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.