Skip to content
Permalink
Browse files
cleanup: remove redundant BANG_PRECEDENCE
prefix unary operators don't need to have different precedence,
the syntax unambiguously specifies in what order they apply
  • Loading branch information
vuvova committed Oct 23, 2020
1 parent 8c83e6e commit 7f974e5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
@@ -8068,7 +8068,7 @@ select !cast(1 as char charset binary) AS `! BINARY 1`,cast(!1 as char charset b
create or replace view v1 as select ! ~ 1, ~ ! 1;
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
view_definition
select !(~1) AS `! ~ 1`,~!1 AS `~ ! 1`
select !~1 AS `! ~ 1`,~!1 AS `~ ! 1`
create or replace view v1 as select - BINARY 1, BINARY - 1;
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
view_definition
@@ -92,8 +92,7 @@ enum precedence {
MUL_PRECEDENCE, // *, /, DIV, %, MOD
BITXOR_PRECEDENCE, // ^
PIPES_PRECEDENCE, // || (if PIPES_AS_CONCAT)
NEG_PRECEDENCE, // unary -, ~
BANG_PRECEDENCE, // !, NOT (if HIGH_NOT_PRECEDENCE)
NEG_PRECEDENCE, // unary -, ~, !, NOT (if HIGH_NOT_PRECEDENCE)
COLLATE_PRECEDENCE, // BINARY, COLLATE
DEFAULT_PRECEDENCE,
HIGHEST_PRECEDENCE
@@ -574,7 +574,7 @@ class Item_func_not :public Item_bool_func
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);

0 comments on commit 7f974e5

Please sign in to comment.