Return-Path: Delivered-To: apmail-db-ddlutils-dev-archive@www.apache.org Received: (qmail 19798 invoked from network); 15 Jan 2007 10:18:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Jan 2007 10:18:48 -0000 Received: (qmail 45122 invoked by uid 500); 15 Jan 2007 10:18:55 -0000 Delivered-To: apmail-db-ddlutils-dev-archive@db.apache.org Received: (qmail 45097 invoked by uid 500); 15 Jan 2007 10:18:55 -0000 Mailing-List: contact ddlutils-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ddlutils-dev@db.apache.org Delivered-To: mailing list ddlutils-dev@db.apache.org Received: (qmail 45085 invoked by uid 99); 15 Jan 2007 10:18:55 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jan 2007 02:18:54 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jan 2007 02:18:47 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 85B657142A6 for ; Mon, 15 Jan 2007 02:18:27 -0800 (PST) Message-ID: <19281439.1168856307518.JavaMail.jira@brutus> Date: Mon, 15 Jan 2007 02:18:27 -0800 (PST) From: =?utf-8?Q?Christoffer_Hammarstr=C3=B6m_=28JIRA=29?= To: ddlutils-dev@db.apache.org Subject: [jira] Commented: (DDLUTILS-150) Trying to change a column makes ddlutils want to drop non-related foreign keys which fails with for example "Can't DROP 'text_docs_FK_meta_id_meta'; check that column/key exists" In-Reply-To: <13659710.1168620387742.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DDLUTILS-150?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464727 ]=20 Christoffer Hammarstr=C3=B6m commented on DDLUTILS-150: -------------------------------------------------- That is, the following code gives the same error. org.apache.ddlutils.model.Database model =3D platform.readM= odelFromDatabase(null); Table textDocsTable =3D model.findTable("text_docs"); ForeignKey[] foreignKeys =3D textDocsTable.getForeignKeys()= ; for ( ForeignKey foreignKey : foreignKeys ) { textDocsTable.removeForeignKey(foreignKey); } platform.alterTables(model, false); > Trying to change a column makes ddlutils want to drop non-related foreign= keys which fails with for example "Can't DROP 'text_docs_FK_meta_id_meta';= check that column/key exists" > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------------------------------ > > Key: DDLUTILS-150 > URL: https://issues.apache.org/jira/browse/DDLUTILS-150 > Project: DdlUtils > Issue Type: Bug > Components: Core - MySql > Environment: MySQL 5.0.20-something, MySQL 5.0.32 on Linux, InnoD= B tables. > Reporter: Christoffer Hammarstr=C3=B6m > Assigned To: Thomas Dudziak > Attachments: DDLUTILS-150.patch > > > I'm trying variations on the following code: > org.apache.ddlutils.model.Database model =3D platform.read= ModelFromDatabase(null); > Table table =3D model.findTable("text_docs"); > Column templateNameColumn =3D table.findColumn("template_= id"); > templateNameColumn.setType("VARCHAR"); > platform.alterTables(model,false); > Trying to change any column makes ddlutil try to drop unrelated foreign k= eys, which in my case fails with the following stack-trace: > org.apache.ddlutils.DatabaseOperationException: Error while executing SQL= ALTER TABLE text_docs > DROP INDEX text_docs_FK_meta_id_meta > =09at org.apache.ddlutils.platform.PlatformImplBase.evaluateBatch(Platfor= mImplBase.java:331) > =09at org.apache.ddlutils.platform.PlatformImplBase.alterTables(PlatformI= mplBase.java:573) > =09at org.apache.ddlutils.platform.PlatformImplBase.alterTables(PlatformI= mplBase.java:507) > ... snipped my classes ... > Caused by: java.sql.SQLException: Can't DROP 'text_docs_FK_meta_id_meta';= check that column/key exists > =09at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847) > =09at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531) > =09at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622) > =09at com.mysql.jdbc.Connection.execSQL(Connection.java:2370) > =09at com.mysql.jdbc.Connection.execSQL(Connection.java:2297) > =09at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1289) > =09at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(Delegatin= gStatement.java:225) > =09at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(Delegatin= gStatement.java:225) > =09at org.apache.ddlutils.platform.PlatformImplBase.evaluateBatch(Platfor= mImplBase.java:309) > =09... 33 more > The ddl for the table looks like this: > > > > > > > > > > > > > > > > >
> I'm not sure if ddlutils should be dropping the foreign keys, but it shou= ld at least not fail with an error. Could this be because i'm using InnoDB = tables? > I've tried both some MySQL 5.0.20 version, and the latest 5.0.32. --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira