Error On Rename Errno 152
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more
Error On Rename Errno 150
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users error on rename of errno 150 mysql Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping
Error On Rename Of '#sql' To ' Errno 150
each other. Join them; it only takes a minute: Sign up unable to drop the foreign key up vote 15 down vote favorite 2 I would like to drop the foreign key in my table but been into mysql error 1025 errno 152 this error message mysql> alter table customers drop foreign key customerid; ERROR 1025 (HY000): Error on rename of '.\products\customers' to '.\products\#sql2-7ec-a3' (errno: 152) mysql> mysql foreign-keys foreign-key-relationship mysql-error-1025 share|improve this question edited May 17 '12 at 9:18 Fahim Parkar 15.8k2395193 asked May 17 '12 at 8:57 solomon 1171210 1 This may help you to understand stackoverflow.com/questions/160233/… –Imdad May 17 '12 at 9:04 @Imdad This link describes another error - (errno: 150) –Devart May 17 mysql error code 1005 errno 150 '12 at 9:17 Try this. Create new table (without foreign key constraint). copy the data to new table (using syntax INSERT INTO new_table SELECT * FROM old_table) Drop the old table –Imdad May 17 '12 at 9:22 Have you checked @Maksym Polshcha's answer? You have to use the foreign key's name not the column name. (it might be something like fk_customerid) –Imdad May 17 '12 at 9:24 check my answer and let me know if you still have problem... –Fahim Parkar May 17 '12 at 9:37 | show 1 more comment 4 Answers 4 active oldest votes up vote 5 down vote accepted To avoid getting this error while trying to drop a foreign key, use the constraint name rather than the column name of the foreign key. When I tried mysql> ALTER TABLE mytable DROP PRIMARY KEY; I got error as ERROR 1025 (HY000): Error on rename of '.\database\#sql-454_3' to '.\database\mytable' (errno: 150). I solved it using: mysql> ALTER TABLE mytable DROP PRIMARY KEY, ADD PRIMARY KEY (column1,column2,column3); Some links that will help you. link 1 link 2 [look for Posted by Alex Blume on November 7 2008 5:09pm & Posted by Hector Delgadillo on January 21 2011 4:57am] share|improve this answer answered May 17 '12 at 9:34 Fahim Parkar 15.8k2395193 not work for me. –user60627 May 25 at
here for a quick overview of the site Help Center Detailed answers
#1025 - Error On Rename Of (errno 150)
to any questions you might have Meta Discuss the workings mysql error 1025 errno 150 and policies of this site About Us Learn more about Stack Overflow the company Business
General Error: 1025 Error On Rename Of Laravel
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/10632587/unable-to-drop-the-foreign-key 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` int(10) http://stackoverflow.com/questions/27952685/remove-then-add-constraint-mysql-causes-error-on-rename-1025 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 column so
Verified Impact on me: None Category:MySQL Server: Parser Severity:S2 (Serious) Version:5.0.15, 5.0.74, 5.1.30, 6.0.9 https://bugs.mysql.com/bug.php?id=14347 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 (HY000): Error error on 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, `NETAMOUNT` decimal(12,2) NOT error on rename 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,'US',1,'UNUKXHJVXB@dell.com','5119315633',1,'3144519586581737','2012/11','user2','password',80,40000,'M'); INSERT INTO `ORDERS` VALUES (10677,'2004-11-10'