Bug #27406 Events: failure only causes a warning
Submitted: 23 Mar 2007 19:16 Modified: 18 Jul 2007 19:25
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1.18-beta-debug OS:Linux (SUSE 10.0 / 64-bit)
Assigned to: Konstantin Osipov CPU Architecture:Any

[23 Mar 2007 19:16] Peter Gulutzan
Description:
The general distinction between warnings (completion conditions)
and errors (exception conditions) is: for a warning, the requested
operation actually succeeds in some way, for an error, it doesn't.

When I try to create an event in the past with NOT PRESERVE,
I see a warning. But the operation fails. So I should see an
error.

See also Bug#16395 Events: CREATE EVENT failure only causes a warning
(closed).

How to repeat:
mysql> create event e2 on schedule at '1970-10-10 00:00:00' do set @a=5;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+-------+------+-------------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                                               |
+-------+------+-------------------------------------------------------------------------------------------------------+
| Note  | 1584 | Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created |
+-------+------+-------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select * from information_schema.events where event_name='e2';
Empty set (0.01 sec)
[23 Mar 2007 22:24] MySQL Verification Team
Thank you for the bug report. Verified as described on FC 6 32-bit.
[30 Mar 2007 20:32] Konstantin Osipov
Peter, the warning messsage is misleading. The correct messsage is:
the event was dropped immediately after creation.
[15 Jul 2007 9:07] Konstantin Osipov
Fixing this bug by changing the wording of the error message.
The new wording is:
Event execution time is in the past and ON COMPLETION NOT PRESERVE is set.
The event was dropped immediately after creation.

We can not return an error in this situation since we want to load correctly old database dumps.
[15 Jul 2007 9:25] 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/30938

ChangeSet@1.2532, 2007-07-15 13:25:38+04:00, kostja@bodhi.(none) +2 -0
  A fix for Bug#27406 Events: failure only causes a warning. Update test
  results.
  When executing a CREATE EVENT statement with ON COMPLETION NOT PRESERVE 
  clause (explicit or implicit) and completion date in the past, we do not 
  create the event. Or, put it differently, we create it and then drop 
  immediately.
  A warning is issued in this case, not an error -- we want to load 
  successfully old database dumps, and such dumps may contain events
  that are no longer valid.
  
  Update the warning text to not imply an erroneous condition.
[15 Jul 2007 9:26] Konstantin Osipov
A trivial change, no reviewer is needed.
[15 Jul 2007 9:36] Konstantin Osipov
Queued in 5.1-runtime
[17 Jul 2007 15:30] Bugs System
Pushed into 5.1.21-beta
[18 Jul 2007 19:25] Paul DuBois
Noted in 5.1.21 changelog.

For some event-creation problems, the server displayed messages that
implied the problems were errors when they were only warnings.