Description:
The documentation for DATE_ADD() [1] mentions that `INTERVAL expr unit` can be used in a plain expression.
Looking at the precedence table [2] there is no indication of the precedence of that expression, leaving the user to guess the precedence.
The YACC source file lists the precedence of the INTERVAL keyword as being the highest (with the associativity being LEFT). [3]
It's not entirely clear if you can nest `INTERVAL expr unit` expressions, even though the parser source seems to indicate it, this is an open question.
[1] http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add
[2] http://dev.mysql.com/doc/refman/5.1/en/operator-precedence.html
[3] relevant portion is:
"
%left NEG '~'
%right NOT_SYM NOT2_SYM
%right BINARY COLLATE_SYM
%left INTERVAL_SYM
"
How to repeat:
.
Suggested fix:
Add INTERVAL to the precedence table.
Figure out what the syntax for nesting INTERVAL expressions is, and if it is possible at all. If possible, give an example in DATE_ADD, if not note that as well.