Commit 8c83e6ea authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: remove redundant ADDINTERVAL_PRECEDENCE

expression between INTERVAL and the unit doesns not need any
precedence rules, there's no ambiguity there
parent 9ad4e0d6
...@@ -87,7 +87,7 @@ enum precedence { ...@@ -87,7 +87,7 @@ enum precedence {
BITOR_PRECEDENCE, // | BITOR_PRECEDENCE, // |
BITAND_PRECEDENCE, // & BITAND_PRECEDENCE, // &
SHIFT_PRECEDENCE, // <<, >> SHIFT_PRECEDENCE, // <<, >>
ADDINTERVAL_PRECEDENCE, // first argument in +INTERVAL INTERVAL_PRECEDENCE, // first argument in +INTERVAL
ADD_PRECEDENCE, // +, - ADD_PRECEDENCE, // +, -
MUL_PRECEDENCE, // *, /, DIV, %, MOD MUL_PRECEDENCE, // *, /, DIV, %, MOD
BITXOR_PRECEDENCE, // ^ BITXOR_PRECEDENCE, // ^
...@@ -95,7 +95,6 @@ enum precedence { ...@@ -95,7 +95,6 @@ enum precedence {
NEG_PRECEDENCE, // unary -, ~ NEG_PRECEDENCE, // unary -, ~
BANG_PRECEDENCE, // !, NOT (if HIGH_NOT_PRECEDENCE) BANG_PRECEDENCE, // !, NOT (if HIGH_NOT_PRECEDENCE)
COLLATE_PRECEDENCE, // BINARY, COLLATE COLLATE_PRECEDENCE, // BINARY, COLLATE
INTERVAL_PRECEDENCE, // INTERVAL
DEFAULT_PRECEDENCE, DEFAULT_PRECEDENCE,
HIGHEST_PRECEDENCE HIGHEST_PRECEDENCE
}; };
......
...@@ -2250,9 +2250,9 @@ static const char *interval_names[]= ...@@ -2250,9 +2250,9 @@ static const char *interval_names[]=
void Item_date_add_interval::print(String *str, enum_query_type query_type) void Item_date_add_interval::print(String *str, enum_query_type query_type)
{ {
args[0]->print_parenthesised(str, query_type, ADDINTERVAL_PRECEDENCE); args[0]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE);
str->append(date_sub_interval?" - interval ":" + interval "); str->append(date_sub_interval?" - interval ":" + interval ");
args[1]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE); args[1]->print(str, query_type);
str->append(' '); str->append(' ');
str->append(interval_names[int_type]); str->append(interval_names[int_type]);
} }
......
...@@ -942,7 +942,7 @@ class Item_date_add_interval :public Item_temporal_hybrid_func ...@@ -942,7 +942,7 @@ class Item_date_add_interval :public Item_temporal_hybrid_func
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
bool eq(const Item *item, bool binary_cmp) const; bool eq(const Item *item, bool binary_cmp) const;
void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type);
enum precedence precedence() const { return ADDINTERVAL_PRECEDENCE; } enum precedence precedence() const { return INTERVAL_PRECEDENCE; }
bool need_parentheses_in_default() { return true; } bool need_parentheses_in_default() { return true; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root) Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_date_add_interval>(thd, mem_root, this); } { return get_item_copy<Item_date_add_interval>(thd, mem_root, this); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment