Error On Rename Of 152
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might mysql error on rename of errno 152 have Meta Discuss the workings and policies of this site About
Error On Rename Of To (errno 150)
Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads error 1025 hy000 error on rename of errno 150 with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million error on rename of drop foreign key programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySQL Drop foreign key Error 152 up vote 9 down vote favorite 1 I am trying to drop a number of foreign keys using: ALTER TABLE `table` DROP FOREIGN KEY `fk_table_users1` , DROP FOREIGN KEY `fk_table_accounts1` , DROP FOREIGN
#1025 - Error On Rename Of (errno 150)
KEY `fk_table_data1` ; but it returns the error: Error on rename of './db/table' to './db/#sql2-179c-288289' (errno: 152) I have run SHOW ENGINE INNODB STATUS which says: 120725 12:38:37 Error in dropping of a foreign key constraint of table db/table, in SQL command ALTER TABLE `table` DROP FOREIGN KEY `fk_table_users1` , DROP FOREIGN KEY `fk_table_accounts1` , DROP FOREIGN KEY `fk_table_data1` Cannot find a constraint with the given id fk_table_users1. SHOW CREATE TABLE 'table' output: CREATE TABLE `table` ( `id` int(11) NOT NULL auto_increment, `data_id` int(11) NOT NULL, `account_id` int(11) NOT NULL, `status` enum('pending','complete') NOT NULL default 'pending', `created_at` datetime NOT NULL, `created_by` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `fk_orders_users1` (`created_by`), KEY `fk_orders_data1` (`data_id`), KEY `fk_orders_accounts1` (`account_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 However when I look at the structure via phpmyadmin it lists the foreign key with the same name. Do I need to do something else before I can drop the foreign keys? mysql foreign-keys alter-table share|improve this question edited Jul 25 '12 at 12:14
here for a quick overview of the site Help Center Detailed answers mysql error 1025 errno 150 to any questions you might have Meta Discuss the workings general error: 1025 error on rename of laravel and policies of this site About Us Learn more about Stack Overflow the company Business
Laravel Drop Foreign Key
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack http://stackoverflow.com/questions/11649092/mysql-drop-foreign-key-error-152 Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Remove then add constraint mysql causes error on rename #1025 up vote 4 down vote favorite 1 Create table: CREATE TABLE `phppos_register_log` ( `register_log_id` http://stackoverflow.com/questions/27952685/remove-then-add-constraint-mysql-causes-error-on-rename-1025 int(10) NOT NULL AUTO_INCREMENT, `employee_id` int(10) NOT NULL, `shift_start` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `shift_end` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `open_amount` decimal(23,10) NOT NULL, `close_amount` decimal(23,10) NOT NULL, `cash_sales_amount` decimal(23,10) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`register_log_id`), KEY `phppos_register_log_ibfk_1` (`employee_id`), CONSTRAINT `phppos_register_log_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `phppos_employees` (`person_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; SQL CODE to rename column: (This works on mysql 5.5 and 5.6 but one user is reporting an issue. (Exact version number 5.5.40) //this is where error is happening ALTER TABLE phppos_register_log DROP FOREIGN KEY phppos_register_log_ibfk_1; ALTER TABLE `phppos_register_log` CHANGE `employee_id` `employee_id_open` INT( 10 ) NOT NULL ; ALTER TABLE `phppos_register_log`ADD CONSTRAINT `phppos_register_log_ibfk_1` FOREIGN KEY (`employee_id_open`) REFERENCES `phppos_employees` (`person_id`); Is anything in mysql 5.5.40 that would cause this code to NOT work? ERROR reported: #1025 - Error on rename of './sole_phppos_144/phppos_register_log' to './sole_phppos_144/#sql2-6224-22975' (errno: 152) NOTE: I am renaming
Verified Impact on me: None Category:MySQL Server: Parser Severity:S2 (Serious) Version:5.0.15, 5.0.74, 5.1.30, https://bugs.mysql.com/bug.php?id=14347 6.0.9 OS:Linux (Linux Suse 10, Windows) Assigned to: Tags: foreign key, innodb Triage: Triaged: D5 (Feature request) View Add Comment Files Developer Edit Submission View Progress Log Contributions [26 Oct 2005 18:53] Vadim Tkachenko Description: When I try ALTER TABLE ORDERS DROP FOREIGN KEY CUSTOMERID; I got: ERROR 1025 error on (HY000): Error on rename of './TESTDB/ORDERS' to './TESTDB/#sql2-3b5b-8' (errno: 152) But I only want to remove FOREIGN KEY and I don't delete any rows. How to repeat: DROP TABLE IF EXISTS `ORDERS`; CREATE TABLE `ORDERS` ( `ORDERID` int(11) NOT NULL auto_increment, `ORDERDATE` date NOT NULL, `CUSTOMERID` int(11) default NULL, error on rename `NETAMOUNT` decimal(12,2) NOT NULL, `TAX` decimal(12,2) NOT NULL, `TOTALAMOUNT` decimal(12,2) NOT NULL, PRIMARY KEY (`ORDERID`), KEY `IX_ORDER_CUSTID` (`CUSTOMERID`), CONSTRAINT `FK_CUSTOMERID` FOREIGN KEY (`CUSTOMERID`) REFERENCES `CUSTOMERS` (`CUSTOMERID`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS `CUSTOMERS`; CREATE TABLE `CUSTOMERS` ( `CUSTOMERID` int(11) NOT NULL auto_increment, `FIRSTNAME` varchar(50) NOT NULL, `LASTNAME` varchar(50) NOT NULL, `ADDRESS1` varchar(50) NOT NULL, `ADDRESS2` varchar(50) default NULL, `CITY` varchar(50) NOT NULL, `STATE` varchar(50) default NULL, `ZIP` int(11) default NULL, `COUNTRY` varchar(50) NOT NULL, `REGION` tinyint(4) NOT NULL, `EMAIL` varchar(50) default NULL, `PHONE` varchar(50) default NULL, `CREDITCARDTYPE` int(11) NOT NULL, `CREDITCARD` varchar(50) NOT NULL, `CREDITCARDEXPIRATION` varchar(50) NOT NULL, `USERNAME` varchar(50) NOT NULL, `PASSWORD` varchar(50) NOT NULL, `AGE` tinyint(4) default NULL, `INCOME` int(11) default NULL, `GENDER` varchar(1) default NULL, PRIMARY KEY (`CUSTOMERID`), UNIQUE KEY `IX_CUST_USERNAME` (`USERNAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `CUSTOMERS` VALUES (1,'VKUUXF','ITHOMQJNYX','4608499546 Dell Way','','QSDPAGD','SD',24101,'US',1,'ITHOMQJNYX@dell.com',' 4608499546',1,'1979279217775911','2012/03','user1','password',55,100000,'M'),(2,'HQNMZH','UNUKXHJVXB','5119315633 Dell Way','','YNCE RXJ','AZ',11802,'U