When I was change the table, the following error was returned.
ERROR 1025 (HY000): Error on rename of './test/#sql-2fa8_1' to './test/test2' (errno: 150)
This case may be occur if foreign key constraint is on the table.
Try to test for this case.
Parent table is PARENT_TBL and child table is CHILD_TBL.
CHILD_TBL is references an id of PARENT_TBL.
If you specify a value that is not in PARENT_TBL by pid error occurs.
INSERT INTO CHILD_TBL (pid, cvalue) values (7, 'child_test') ;
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`test`.`CHILD_TBL`, CONSTRAINT `fk_parent_tbl_id` FOREIGN KEY (`pid`) REFERENCES `PARENT_TBL` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
And then let's perform an alter to change the id column type.
The error occurs.
In this case, drop fk constraint on the child table before altering the parent table. (temporarily)
When alter command finished, you should check the schema is changed to bigint.
If you want to find more errors, see the following command:
댓글 없음:
댓글 쓰기