diff options
author | Igor Babaev <igor@askmonty.org> | 2020-11-18 13:21:19 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2020-11-19 07:47:43 -0800 |
commit | 1248c654c494df6df3dedf610e322f69a85d3102 (patch) | |
tree | 4887e0abe9dcd120f720fbe8e0526a8fb1475c0e /sql/item.h | |
parent | bbbab8215f61ac6aa0af5c4f6a5a8509e9707e68 (diff) | |
download | mariadb-git-1248c654c494df6df3dedf610e322f69a85d3102.tar.gz |
MDEV-19179 Regression: SELECT ... UNION ... with inconsistent column names fails
A bogus error message was issued when a condition was pushed into a
materialized derived table or view specified as union of selects with
aggregation when the corresponding columns of the selects had different
names. This happened because the expression pushed into having clauses of
the selects was adjusted for the names of the first select of the union.
The easiest solution was to rename the columns of the other selects to be
name compatible with the columns of the first select.
Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h index a49f9e8e5e4..ed20074a8da 100644 --- a/sql/item.h +++ b/sql/item.h @@ -818,6 +818,12 @@ public: void set_name_for_rollback(THD *thd, const char *str, uint length, CHARSET_INFO *cs); void rename(char *new_name); + void share_name_with(Item *item) + { + name= item->name; + name_length= item->name_length; + is_autogenerated_name= item->is_autogenerated_name; + } void init_make_field(Send_field *tmp_field,enum enum_field_types type); virtual void cleanup(); virtual void make_field(THD *thd, Send_field *field); |