Bug #16878 dump of trigger
| Submitted: | 29 Jan 2006 0:33 | Modified: | 27 Feb 2006 20:40 |
|---|---|---|---|
| Reporter: | Gui Gros | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.18 | OS: | Any (All) |
| Assigned to: | Magnus Blåudd | CPU Architecture: | Any |
[29 Jan 2006 0:33]
Gui Gros
[29 Jan 2006 10:27]
Jorge del Conde
Thanks for your bug report. I was able to reproduce this under XP and FC4: C:\my>mysql test < t.sql ERROR 1064 (42000) at line 64: You have an error in your SQL syntax; check the m anual that corresponds to your MySQL server version for the right syntax to use near '/' at line 2
[8 Feb 2006 14:06]
Magnus Blåudd
mysqldump will produce the following SQL when dumping the trigger: mysql> DELIMITER ;; mysql> /*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW set new.created=now() */;; mysql> DELIMITER ; When restoring this statement with "mysql" it seems like the server is confused with the last "end of comment" (*/). And it will give error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/' at line 2 Even if a semicolon(;) is added after now(). It will bail out complainig about (*/) mysql> DELIMITER ;; mysql> /*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW set new.created=now(); */;; mysql> DELIMITER ; "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set new.created=now(); */' at line 1" But if the last /*!50003 ... */ is removed the command will be accepted. mysql> /*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW set new.c=now() ;; Query OK, 0 rows affected (0.00 sec) So I assume the parser think that the eding comment belongs to a comment started within the trigger.
[9 Feb 2006 10:12]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/2354
[24 Feb 2006 8:18]
Magnus Blåudd
Pushed a fix to 5.0.19 and 5.1.8 that makes the parser handle "single statement" triggers with embedded "not version" comments like /*!50001 <feature> */. Ex of a trigger that couldn't be loaded without this fix. /*!50003 CREATE TRIGGER `ins_trans` BEFORE INSERT ON `transactions` FOR EACH ROW SET NEW.CREATED=NOW() */ Also fixes bug#14857
[27 Feb 2006 20:40]
Mike Hillyer
Documented in 5.0.19 and 5.1.8 changelogs:
<listitem>
<para>
Triggers created without <literal>BEGIN</literal> and
<literal>END</literal> clauses could not be properly restored
from a <filename>mysqldump</filename> file. (Bug #16878)
</para>
</listitem>
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.043 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.