diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-07-08 16:26:34 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-07-08 16:26:34 +0200 |
commit | f62b7b2a94d775c3fa52bf7c756eac29c016ad76 (patch) | |
tree | 10655531f8c2d3c22d9a1422b9f05ebe8055ef3c /sql/sql_show.cc | |
parent | f3f23b5c4bdc669ad0af4a1c79bd70c40ed9c594 (diff) | |
download | mariadb-git-bb-10.3-MDEV-21201.tar.gz |
MDEV-21201 No records produced in information_schema query, depending on projectionbb-10.3-MDEV-21201
In case of USING check also join field list to mark fields as used.
In case of NATURAL JOIN mark all field (one table can not be opened
in any case so optimisation does not worth it).
IMHO table should be checked for used fields and filled after prepare,
when we will fave whole info about used fields but it is too big change
for a bugfix.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 3dbc7724928..52b367dfe4b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8094,7 +8094,8 @@ static void mark_all_fields_used_in_query(THD *thd, ST_FIELD_INFO *schema_fields, MY_BITMAP *bitmap, - Item *all_items) + Item *all_items, + List<String> *join_using) { Item *item; DBUG_ENTER("mark_all_fields_used_in_query"); @@ -8132,6 +8133,25 @@ mark_all_fields_used_in_query(THD *thd, } } } + if (join_using) + { + List_iterator_fast<String> it(*join_using); + String *nm; + while ((nm= it++)) + { + ST_FIELD_INFO *fields= schema_fields; + uint count; + for (count=0; fields->field_name; fields++, count++) + { + if (!my_strcasecmp(system_charset_info, fields->field_name, + nm->ptr())) + { + bitmap_set_bit(bitmap, count); + break; + } + } + } + } DBUG_VOID_RETURN; } @@ -8183,7 +8203,12 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) else all_items= thd->free_list; - mark_all_fields_used_in_query(thd, fields_info, &bitmap, all_items); + if ((table_list->natural_join || table_list->part_of_natural_join) && + table_list->join_using == NULL) + bitmap_set_all(&bitmap); + else + mark_all_fields_used_in_query(thd, fields_info, &bitmap, all_items, + table_list->join_using); for (field_count=0; fields_info->field_name; fields_info++) { |