diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-10-05 13:41:16 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-10-05 13:41:16 +0400 |
commit | 1cfaafafee1d3e25470508c0479210c615fa3f18 (patch) | |
tree | 89add928ed09b5dcfe270b3a3662f5e044db0b82 /sql | |
parent | bcda03b4fa3ce8286a264bf3c9b1996ba7088d4f (diff) | |
download | mariadb-git-1cfaafafee1d3e25470508c0479210c615fa3f18.tar.gz |
MDEV-13242 Wrong results for queries with row constructors and information_schema
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h index c338b14e340..0ca2eaae97c 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4131,6 +4131,8 @@ public: bool fix_fields(THD *thd, Item **it); void cleanup(); + Item *get_orig_item() const { return orig_item; } + /* Methods of getting value which should be cached in the cache */ void save_val(Field *to); double val_real(); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 953842e29d1..1fdab201158 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3640,6 +3640,15 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table) return 0; } } + else if (item->type() == Item::ROW_ITEM) + { + Item_row *item_row= static_cast<Item_row*>(item); + for (uint i= 0; i < item_row->cols(); i++) + { + if (!uses_only_table_name_fields(item_row->element_index(i), table)) + return 0; + } + } else if (item->type() == Item::FIELD_ITEM) { Item_field *item_field= (Item_field*)item; @@ -3659,6 +3668,11 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table) strlen(item_field->field_name), 0))) return 0; } + else if (item->type() == Item::EXPR_CACHE_ITEM) + { + Item_cache_wrapper *tmp= static_cast<Item_cache_wrapper*>(item); + return uses_only_table_name_fields(tmp->get_orig_item(), table); + } else if (item->type() == Item::REF_ITEM) return uses_only_table_name_fields(item->real_item(), table); |