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 "Christoffer Hammarström (JIRA)" <ji...@apache.org> on 2006/05/10 17:23:05 UTC

[jira] Created: (DDLUTILS-106) Long similar foreign key names are shortened to conflicting names

Long similar foreign key names are shortened to conflicting names
-----------------------------------------------------------------

         Key: DDLUTILS-106
         URL: http://issues.apache.org/jira/browse/DDLUTILS-106
     Project: DdlUtils
        Type: Bug

  Components: Core  
    Reporter: Christoffer Hammarström
 Assigned to: Thomas Dudziak 


In my generated sql for Oracle, i find the following two conflicting statements:

ALTER TABLE doc_permission_sets
    ADD CONSTRAINT doc_permission_ermission_sets FOREIGN KEY (set_id) REFERENCES permission_sets (set_id);

and 

ALTER TABLE doc_permission_sets_ex
    ADD CONSTRAINT doc_permission_ermission_sets FOREIGN KEY (set_id) REFERENCES permission_sets (set_id);

The tables have similar names, and the foreign key names conflict.

Oracle gives the following error when trying to run the sql:

 ORA-02264: name already used by an existing constraint

Maybe SqlBuilder.shortenName() could use some kind of counter for conflicting names?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DDLUTILS-106) Long similar foreign key names are shortened to conflicting names

Posted by "Christoffer Hammarström (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DDLUTILS-106?page=comments#action_12402313 ] 

Christoffer Hammarström commented on DDLUTILS-106:
--------------------------------------------------

I didn't realise i could specify a foreign key name. Silly me. :)

In that case it shouldn't  be a problem. Thanks!


> Long similar foreign key names are shortened to conflicting names
> -----------------------------------------------------------------
>
>          Key: DDLUTILS-106
>          URL: http://issues.apache.org/jira/browse/DDLUTILS-106
>      Project: DdlUtils
>         Type: Bug

>   Components: Core
>     Reporter: Christoffer Hammarström
>     Assignee: Thomas Dudziak

>
> In my generated sql for Oracle, i find the following two conflicting statements:
> ALTER TABLE doc_permission_sets
>     ADD CONSTRAINT doc_permission_ermission_sets FOREIGN KEY (set_id) REFERENCES permission_sets (set_id);
> and 
> ALTER TABLE doc_permission_sets_ex
>     ADD CONSTRAINT doc_permission_ermission_sets FOREIGN KEY (set_id) REFERENCES permission_sets (set_id);
> The tables have similar names, and the foreign key names conflict.
> Oracle gives the following error when trying to run the sql:
>  ORA-02264: name already used by an existing constraint
> Maybe SqlBuilder.shortenName() could use some kind of counter for conflicting names?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DDLUTILS-106) Long similar foreign key names are shortened to conflicting names

Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DDLUTILS-106?page=all ]
     
Thomas Dudziak resolved DDLUTILS-106:
-------------------------------------

    Resolution: Won't Fix

Adding any checks against other foreign keys in the same model would mean introducing a lot of changes to the public API because foreign key names are used in a lot of places where only the table of the foreign key is available, but not the model. Since the benefit of such a check is IMO only minor, I'll rather add a warning when a foreign key without a name is encountered.

> Long similar foreign key names are shortened to conflicting names
> -----------------------------------------------------------------
>
>          Key: DDLUTILS-106
>          URL: http://issues.apache.org/jira/browse/DDLUTILS-106
>      Project: DdlUtils
>         Type: Bug

>   Components: Core
>     Reporter: Christoffer Hammarström
>     Assignee: Thomas Dudziak

>
> In my generated sql for Oracle, i find the following two conflicting statements:
> ALTER TABLE doc_permission_sets
>     ADD CONSTRAINT doc_permission_ermission_sets FOREIGN KEY (set_id) REFERENCES permission_sets (set_id);
> and 
> ALTER TABLE doc_permission_sets_ex
>     ADD CONSTRAINT doc_permission_ermission_sets FOREIGN KEY (set_id) REFERENCES permission_sets (set_id);
> The tables have similar names, and the foreign key names conflict.
> Oracle gives the following error when trying to run the sql:
>  ORA-02264: name already used by an existing constraint
> Maybe SqlBuilder.shortenName() could use some kind of counter for conflicting names?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DDLUTILS-106) Long similar foreign key names are shortened to conflicting names

Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DDLUTILS-106?page=comments#action_12383278 ] 

Thomas Dudziak commented on DDLUTILS-106:
-----------------------------------------

DdlUtils already contains a decent algorithm for generating a foreign key name that leads to good results. The problem is that it is next to impossible to generate unique foreign key names that are reproducable (otherwise you simply could use some GUID algorithm). So, you should always specify a foreign key name to avoid issues like this.
I can however add a simple check which tests that no other foreign key within the model would produce the same name. Everything else (e.g. checking against the database) is not much of an option because the SQL written to a file is required to be the same as the SQL executed against the database.

> Long similar foreign key names are shortened to conflicting names
> -----------------------------------------------------------------
>
>          Key: DDLUTILS-106
>          URL: http://issues.apache.org/jira/browse/DDLUTILS-106
>      Project: DdlUtils
>         Type: Bug

>   Components: Core
>     Reporter: Christoffer Hammarström
>     Assignee: Thomas Dudziak

>
> In my generated sql for Oracle, i find the following two conflicting statements:
> ALTER TABLE doc_permission_sets
>     ADD CONSTRAINT doc_permission_ermission_sets FOREIGN KEY (set_id) REFERENCES permission_sets (set_id);
> and 
> ALTER TABLE doc_permission_sets_ex
>     ADD CONSTRAINT doc_permission_ermission_sets FOREIGN KEY (set_id) REFERENCES permission_sets (set_id);
> The tables have similar names, and the foreign key names conflict.
> Oracle gives the following error when trying to run the sql:
>  ORA-02264: name already used by an existing constraint
> Maybe SqlBuilder.shortenName() could use some kind of counter for conflicting names?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira