Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm getting this error:

  • SQLSTATE[HY000]: General error: 1025 Error on rename of './salt/ghost' to './salt/#sql2-4ab-630b' (errno: 152). Failing Query: "ALTER TABLE ghost DROP FOREIGN KEY ghost.row_id"

I looked for some information but I didn't get a solution..any help?

This is my DDL:

ghost,"CREATE TABLE `ghost` (
  `packet_number` int(11) DEFAULT NULL,
  `tbl_name` varchar(50) DEFAULT NULL,
  `row_id` int(11) DEFAULT NULL,
  `row_id2` int(11) DEFAULT NULL,
  `column_name` varchar(50) DEFAULT NULL,
  `old_value` mediumblob,
  `new_value` mediumblob,
  `ghost_action` varchar(255) DEFAULT NULL,
  `ghost_user_id` int(11) DEFAULT NULL,
  `ghost_action_comments` varchar(255) DEFAULT NULL,
  `ghost_status_id` int(11) DEFAULT '1',
  `ghost_status_comments` varchar(255) DEFAULT NULL,
  `serialized` mediumblob,
  `parent_id` int(11) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `created_by` bigint(20) DEFAULT NULL,
  `updated_by` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_change_1_idx` (`ghost_user_id`),
  KEY `fk_change_2_idx` (`ghost_status_id`),
  KEY `row_id2_idx` (`row_id2`),
  CONSTRAINT `ghost_ghost_status_id_ghost_status_id` FOREIGN KEY (`ghost_status_id`) REFERENCES `ghost_status` (`id`),
  CONSTRAINT `ghost_ghost_user_id_sf_guard_user_id` FOREIGN KEY (`ghost_user_id`) REFERENCES `sf_guard_user` (`id`)


share|improve this question

Without knowing your DDL, I did find this on the docs regarding error code 1025, in one of the user comments:

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.

So, instead of dropping the ghost.row_id column, try dropping the foreign key using the FK name.

share|improve this answer
Thanks DTest, could you tell what is the FK name? – user248959 Feb 20 '12 at 17:15
@user248959 Err, you don't seem to have a foreign key for row_id2 – Derek Downey Feb 20 '12 at 17:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.