summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-09-15 00:29:56 +0200
committerSergei Golubchik <serg@mariadb.org>2017-09-18 10:12:23 +0200
commitfb2035a1a37bb3dfe8311e0bb2b9d474837c035c (patch)
tree6c04aa9400ab51881d03f73a1706e1609525db5d /sql/item_func.cc
parent16b1cb650283593f565c53226f7481cacde17a30 (diff)
downloadmariadb-git-fb2035a1a37bb3dfe8311e0bb2b9d474837c035c.tar.gz
MDEV-13673 Bad result in view
When printing an expression, like a/(b*c), we need to print parentheses, even though / and * have the same precedence. Basically, we should always treat the second argument as having one level higher precedence than it normally is.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 4a9fa3342e6..f452b820090 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -479,7 +479,8 @@ void Item_func::print_op(String *str, enum_query_type query_type)
str->append(func_name());
str->append(' ');
}
- args[arg_count-1]->print_parenthesised(str, query_type, precedence());
+ args[arg_count-1]->print_parenthesised(str, query_type,
+ (enum precedence)(precedence() + 1));
}