diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-11-27 19:50:02 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-12-02 16:19:13 +0100 |
commit | 401ae95a6089b0cec5e5b9900bdb44a1f78c4248 (patch) | |
tree | 89bf2ec9f99ae4fcc2e7cb7d3179d7faf6522a59 /sql | |
parent | 37bfe32c6d4a65ea7b8297817e01954d6212c863 (diff) | |
download | mariadb-git-401ae95a6089b0cec5e5b9900bdb44a1f78c4248.tar.gz |
MDEV-30082 View definition losing brackets changes semantics of the query and causes wrong result
Item_func_not_all::print() either uses Item_func::print() or
directly invokes args[0]->print(). Thus the precedence should be
either the one of Item_func or of args[0].
Item_allany_subselect::print() prints args[0], then a comparison op,
then a subquery. That is, the precedence should be the one of
a comparison.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.h | 2 | ||||
-rw-r--r-- | sql/item_subselect.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index f3d3be44b62..671fa52635d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -668,6 +668,8 @@ public: longlong val_int(); enum Functype functype() const { return NOT_ALL_FUNC; } const char *func_name() const { return "<not>"; } + enum precedence precedence() const + { return show ? Item_func::precedence() : args[0]->precedence(); } bool fix_fields(THD *thd, Item **ref) {return Item_func::fix_fields(thd, ref);} virtual void print(String *str, enum_query_type query_type); diff --git a/sql/item_subselect.h b/sql/item_subselect.h index b95a02d28b2..32bedb522ac 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -783,6 +783,7 @@ public: bool select_transformer(JOIN *join); void create_comp_func(bool invert) { func= func_creator(invert); } void print(String *str, enum_query_type query_type); + enum precedence precedence() const { return CMP_PRECEDENCE; } bool is_maxmin_applicable(JOIN *join); bool transform_into_max_min(JOIN *join); void no_rows_in_result(); |