Bug #46293 Conditional comments not working in FOREIGN KEY definition
Submitted: 19 Jul 2009 18:25 Modified: 20 Jul 2009 5:32
Reporter: Aleksander Machniak Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:5.0.51a-3ubuntu5.4, 4.1, 5.0, 5.1 bzr, azalea OS:Linux
Assigned to:
Tags: foreign key comment
Triage: Triaged: D4 (Minor)

[19 Jul 2009 18:25] Aleksander Machniak
Description:
For:

CREATE TABLE `messages` (
 `message_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
 `user_id` int(11) UNSIGNED NOT NULL DEFAULT '0',
 PRIMARY KEY(`message_id`),
 CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
   REFERENCES `users` (`user_id`)
   /*!40008 ON DELETE CASCADE ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */

foreign key is created without ON DELETE and ON UPDATE clauses. If I remove comment everything's fine. The second conditional comment for table engine is working without problem. 

How to repeat:
CREATE TABLE `users` (
 `user_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
 PRIMARY KEY(`user_id`)
);
CREATE TABLE `messages` (
 `message_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
 `user_id` int(11) UNSIGNED NOT NULL DEFAULT '0',
 PRIMARY KEY(`message_id`),
 CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
   REFERENCES `users` (`user_id`)
   /*!40008 ON DELETE CASCADE ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */;
[19 Jul 2009 20:06] Peter Laursen
Same for me with server 5.1.36 on Windows7 RC (64 bit)
[20 Jul 2009 5:32] Sveta Smirnova
Thank you for the report.

Verified as described.