[ 
https://issues.apache.org/jira/browse/DDLUTILS-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645156#action_12645156
 ] 

Thomas Dudziak commented on DDLUTILS-195:
-----------------------------------------

Are you talking about the lower_case_table_names configuration option ? A 
normal Linux Mysql installation should not require tweaking this setting. Could 
you try these two sets of SQL:

(1)

CREATE TABLE Roundtrip1
(
    Pk1 INTEGER NOT NULL,
    Pk2 DOUBLE NOT NULL,
    PRIMARY KEY (Pk1, Pk2)
) ENGINE=InnoDB;

CREATE TABLE Roundtrip2
(
    Pk INTEGER NOT NULL,
    Avalue1 DOUBLE NOT NULL,
    Avalue2 INTEGER NOT NULL,
    PRIMARY KEY (Pk)
) ENGINE=InnoDB;

ALTER TABLE Roundtrip2
    ADD CONSTRAINT Rt1_To_Rt2 FOREIGN KEY (Avalue2, Avalue1) REFERENCES 
Roundtrip1 (Pk1, Pk2);

ALTER TABLE Roundtrip2
    DROP FOREIGN KEY Rt1_To_Rt2;

ALTER TABLE Roundtrip2
    DROP INDEX Rt1_To_Rt2;


(2)

CREATE TABLE `Roundtrip1`
(
    `Pk1` INTEGER NOT NULL,
    `Pk2` DOUBLE NOT NULL,
    PRIMARY KEY (`Pk1`, `Pk2`)
) ENGINE=InnoDB;


CREATE TABLE `Roundtrip2`
(
    `Pk` INTEGER NOT NULL,
    `Avalue1` DOUBLE NOT NULL,
    `Avalue2` INTEGER NOT NULL,
    PRIMARY KEY (`Pk`)
) ENGINE=InnoDB;

ALTER TABLE `Roundtrip2`
    ADD CONSTRAINT `Rt1_To_Rt2` FOREIGN KEY (`Avalue2`, `Avalue1`) REFERENCES 
`Roundtrip1` (`Pk1`, `Pk2`);

ALTER TABLE `Roundtrip2`
    DROP FOREIGN KEY `Rt1_To_Rt2`;

ALTER TABLE `Roundtrip2`
    DROP INDEX `Rt1_To_Rt2`;


Both of these should work fine (they run without problems on my my 5.0.51a 
installation running with default configuration on Ubuntu). 

> Can not update a foreign key on a case sensetive MySql Database
> ---------------------------------------------------------------
>
>                 Key: DDLUTILS-195
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-195
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - MySql
>    Affects Versions: 1.1
>         Environment: Trying to update a existing case sensitive mysql 
> database on Linux 
>            Reporter: meindert hoving
>            Assignee: Thomas Dudziak
>             Fix For: 1.1
>
>
> For testing purposes I made my MySql database case sensitive (to avoid 
> problems when deploying to linux)
> The foreign key restrained throws the following exception;
> throw new ModelException("The foreignkey "+fkDesc+" in table 
> "+curTable.getName()+" references the undefined table 
> "+fk.getForeignTableName());
> fk.getForeignTableName is all lower case, while the table name is camel case. 
> hacking the correct camel case into the piece of code that throws the 
> exception 'fixes' the issue. Therefore the issue is that 
> fk.getForeignTableName()) contains the wrong table name.
> This wrong table name comes from JdbcModelReader
> fk.setForeignTableName((String)values.get("PKTABLE_NAME"));
> The PKTABLE_NAME value comes from readColumn what returns the table name in 
> lowercase

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to