-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Here:
http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html they say: "To find out the symbol value when you want to drop a foreign key, use the SHOW CREATE TABLE statement." David mdipierro napsal(a): > One more reason to have mysql. > > How do we figure out the name of the foreign key from the name of the > table/field? > > Massimo > > > > On Jul 22, 10:10 am, David Zejda <[email protected]> wrote: > Yes, the problem is connected with dropping the index on interrelated > field. If I try to manually > > DROP INDEX field2__idx ON testing4; > > or > > ALTER TABLE testing4 DROP field2; > > i get the error too. I examined the problem more and the result is: > > Field with a FOREIGN KEY can't stay without at least one index defined > on it. But if you remove the relation first: > > ALTER TABLE testing4 DROP FOREIGN KEY testing4_ibfk_1; > > Either the index or the whole field may be removed without error.. > > David > > mdipierro napsal(a): > >>>> OK, I see we have a problem with removing fields that have an index >>>> associated to them. >>>> Can you try remove the index manually and then attempt the migration? >>>> Massimo >>>> On Jul 21, 5:45 pm, Fran <[email protected]> wrote: >>>>> On Jul 21, 11:42 pm, Fran <[email protected]> wrote: >>>>>> Confirmed. MySQL-5.1.36 with MySQL-python-1.2.2.win32 on Python-2.5.4 >>>>>> on Windows XP >>>>>> OperationalError: (1025, "Error on rename of '.\\db\\#sql-198_4' to '.\ >>>>>> \db\\testing4' (errno: 150)") >>>>> sql.log doesn't show anything interesting: >>>>> timestamp: 2009-07-21T23:39:53.171000 >>>>> CREATE TABLE ref2( >>>>> id INT AUTO_INCREMENT NOT NULL, >>>>> name VARCHAR(32), >>>>> PRIMARY KEY(id) >>>>> ) ENGINE=InnoDB CHARACTER SET utf8; >>>>> success! >>>>> timestamp: 2009-07-21T23:39:53.750000 >>>>> CREATE TABLE testing4( >>>>> id INT AUTO_INCREMENT NOT NULL, >>>>> field VARCHAR(32), >>>>> field2 INT, INDEX field2__idx (field2), FOREIGN KEY (field2) >>>>> REFERENCES ref2(id) ON DELETE CASCADE, >>>>> PRIMARY KEY(id) >>>>> ) ENGINE=InnoDB CHARACTER SET utf8; >>>>> success! >>>>> timestamp: 2009-07-21T23:40:27.906000 >>>>> ALTER TABLE testing4 DROP COLUMN field2; >>>>> F > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqxUucACgkQ3oCkkciamVHUWQCggWwyEIJVBCpfIN5lIOIslQZs cx8An1K/h6PKBtkRbXusmFXQJGlYE23w =ukBM -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

