Bug #16433 Events: I can't use the word INTERVAL
Submitted: 12 Jan 2006 4:32 Modified: 14 Feb 2006 11:13
Reporter: Peter Gulutzan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1.6-alpha-debug OS:Linux (linux)
Assigned to: CPU Architecture:Any

[12 Jan 2006 4:32] Peter Gulutzan
Description:
The schedule_time is supposed to be an interval expression,
so I tried:
create event e_46 on schedule every interval 1 second do set @a = 5;
It failed. I'm only allowed to say "EVERY 1 SECOND".

How to repeat:

mysql> create event e_46 on schedule every interval 1 second do set @a = 5;
ERROR 1064 (42000): 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 'do set @a = 5' at line 1
[18 Jan 2006 18:00] Sergei Golubchik
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

"interval expression" is what follows the word INTERVAL. E.g. (quoting the manual)

   * `DATE_ADD(DATE,INTERVAL EXPR TYPE)', `DATE_SUB(DATE,INTERVAL EXPR TYPE)'

     These functions perform date arithmetic.  DATE is a `DATETIME' or
     `DATE' value specifying the starting date. EXPR is an expression
     specifying the interval value to be added or subtracted from the
     starting date.

After EVERY MySQL also expects "an expression specifying the interval value"
[18 Jan 2006 19:19] Peter Gulutzan
The argument for saying "not a bug", if I understand it, is that the manual
mentions that DATE_ADD() has
INTERVAL expr type
Since INTERVAL is not part of "expr", we should
disallow the keyword INTERVAL.
However, "type" includes DAY, MONTH, etc. So, by
the same logic, MySQL should disallow ON SCHEDULE
EVERY 1 DAY. In other words, applying this argument
would lead to an unacceptable conclusion.

MySQL does allow expressions containing the word
INTERVAL, e.g. CURRENT_TIMESTAMP + INTERVAL 1 DAY,
and the ANSI/ISO description for an "interval literal"
says the word INTERVAL is okay.
[14 Feb 2006 11:13] Sergei Golubchik
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

See http://dev.mysql.com/doc/refman/5.1/en/events-create.html