Bug #35296 CREATE EVENT does not clear warnings
Submitted: 14 Mar 2008 16:01 Modified: 23 Jan 2009 16:19
Reporter: Paul DuBois Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1.24/6.0 OS:Any
Assigned to: Davi Arnaut CPU Architecture:Any

[14 Mar 2008 16:01] Paul DuBois
Description:
CREATE EVENT does not clear warnings generated by a previous statement.

How to repeat:
Test script:

-- make sure that the event doesn't exist
DROP EVENT IF EXISTS myevent;
-- this should generate a warning that the event doesn't exist
DROP EVENT IF EXISTS myevent;
-- display the warning
SHOW WARNINGS;
-- create the event; no warning should occur
CREATE EVENT myevent ON SCHEDULE EVERY 15 SECOND DO SET @x = 1;
-- this displays the warning that the event doesn't exist,
-- but it was just created, with no warnings!
SHOW WARNINGS;
-- prove that the event exists
SHOW CREATE EVENT myevent\G

Result of running the script:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.1.24-rc-debug-log 

mysql> -- make sure that the event doesn't exist
mysql> DROP EVENT IF EXISTS myevent;
Query OK, 0 rows affected (0.12 sec)

mysql> -- this should generate a warning that the event doesn't exist
mysql> DROP EVENT IF EXISTS myevent;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> -- display the warning
mysql> SHOW WARNINGS;
+-------+------+------------------------------+
| Level | Code | Message                      |
+-------+------+------------------------------+
| Note  | 1305 | Event myevent does not exist | 
+-------+------+------------------------------+
1 row in set (0.01 sec)

mysql> -- create the event; no warning should occur
mysql> CREATE EVENT myevent ON SCHEDULE EVERY 15 SECOND DO SET @x = 1;
Query OK, 0 rows affected (0.03 sec)

mysql> -- this displays the warning that the event doesn't exist,
mysql> -- but it was just created, with no warnings!
mysql> SHOW WARNINGS;
+-------+------+------------------------------+
| Level | Code | Message                      |
+-------+------+------------------------------+
| Note  | 1305 | Event myevent does not exist | 
+-------+------+------------------------------+
1 row in set (0.03 sec)

mysql> -- prove that the event exists
mysql> SHOW CREATE EVENT myevent\G
*************************** 1. row ***************************
               Event: myevent
            sql_mode: 
           time_zone: SYSTEM
        Create Event: CREATE EVENT `myevent` ON SCHEDULE EVERY 15 SECOND STARTS '2008-03-14 10:59:46' ON COMPLETION NOT PRESERVE ENABLE DO SET @x = 1
character_set_client: latin1
collation_connection: latin1_swedish_ci
  Database Collation: latin1_swedish_ci
1 row in set (0.01 sec)
[14 Mar 2008 16:34] MySQL Verification Team
Thank you for the bug report.
[23 Jan 2009 1:24] Davi Arnaut
12.5.5.42. SHOW WARNINGS Syntax

Statements that do not use tables and do not generate messages have no effect on the message list.