From 7f974e5ad3317168f174465dc61c0feb27c04162 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 16 Oct 2020 15:07:34 +0200 Subject: cleanup: remove redundant BANG_PRECEDENCE prefix unary operators don't need to have different precedence, the syntax unambiguously specifies in what order they apply --- sql/item_cmpfunc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index cad179dff74..579b1bde1ce 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -574,7 +574,7 @@ public: longlong val_int(); enum Functype functype() const { return NOT_FUNC; } const char *func_name() const { return "not"; } - enum precedence precedence() const { return BANG_PRECEDENCE; } + enum precedence precedence() const { return NEG_PRECEDENCE; } Item *neg_transformer(THD *thd); bool fix_fields(THD *, Item **); virtual void print(String *str, enum_query_type query_type); -- cgit v1.2.1 From 05a878c139963d4859ef8f2c974fee5dae56ee51 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 5 Oct 2020 12:50:51 +0200 Subject: precedence bugfixing fix printing precedence for BETWEEN, LIKE/ESCAPE, REGEXP, IN don't use precedence for printing CASE/WHEN/THEN/ELSE/END fix parsing precedence of BETWEEN, LIKE/ESCAPE, REGEXP, IN support predicate arguments for IN, BETWEEN, SOUNDS LIKE, LIKE/ESCAPE, REGEXP use %nonassoc for unary operators fix parsing of IS TRUE/FALSE/UNKNOWN/NULL remove parser_precedence test as superseded by the precedence test --- sql/item_cmpfunc.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 579b1bde1ce..22736339bf6 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1590,7 +1590,6 @@ public: uint decimal_precision() const; table_map not_null_tables() const { return 0; } const char *func_name() const { return "case"; } - enum precedence precedence() const { return BETWEEN_PRECEDENCE; } virtual void print(String *str, enum_query_type query_type); Item *find_item(String *str); CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } @@ -1704,7 +1703,7 @@ public: virtual void print(String *str, enum_query_type query_type); enum Functype functype() const { return IN_FUNC; } const char *func_name() const { return "in"; } - enum precedence precedence() const { return CMP_PRECEDENCE; } + enum precedence precedence() const { return IN_PRECEDENCE; } bool eval_not_null_tables(void *opt_arg); void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); bool count_sargable_conds(void *arg); @@ -1999,7 +1998,7 @@ public: return this; } const char *func_name() const { return "like"; } - enum precedence precedence() const { return CMP_PRECEDENCE; } + enum precedence precedence() const { return IN_PRECEDENCE; } bool fix_fields(THD *thd, Item **ref); bool fix_length_and_dec() { @@ -2127,7 +2126,7 @@ public: bool fix_fields(THD *thd, Item **ref); bool fix_length_and_dec(); const char *func_name() const { return "regexp"; } - enum precedence precedence() const { return CMP_PRECEDENCE; } + enum precedence precedence() const { return IN_PRECEDENCE; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; } void print(String *str, enum_query_type query_type) { -- cgit v1.2.1