summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-07-08 16:26:34 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2020-07-31 13:43:03 +0200
commita8458a2345ea2497ada2f1bd01aeb9c34934dfc6 (patch)
tree86aac1037b9f28970e99f9b1c9f5dcc500b89830 /sql
parent78c2a5ab7061842b449e4acdbc725cdff2593549 (diff)
downloadmariadb-git-a8458a2345ea2497ada2f1bd01aeb9c34934dfc6.tar.gz
MDEV-21201 No records produced in information_schema query, depending on projection
In case of NATURAL JOIN / USING 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. Which will be made later by Serg patch
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_show.cc5
-rw-r--r--sql/table.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ac73b5e9cdf..6802816caaf 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -8904,6 +8904,8 @@ void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields,
SELECT_LEX *lex)
{
b->natural_join= a;
+ a->part_of_natural_join= TRUE;
+ b->part_of_natural_join= TRUE;
lex->prev_join_using= using_fields;
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 3dbc7724928..c6e801b7976 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -8183,7 +8183,10 @@ 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->part_of_natural_join)
+ bitmap_set_all(&bitmap);
+ else
+ mark_all_fields_used_in_query(thd, fields_info, &bitmap, all_items);
for (field_count=0; fields_info->field_name; fields_info++)
{
diff --git a/sql/table.h b/sql/table.h
index a5821a712c6..3d289bf241a 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2183,6 +2183,7 @@ struct TABLE_LIST
parsing 'this' is a NATURAL/USING join iff (natural_join != NULL).
*/
TABLE_LIST *natural_join;
+ bool part_of_natural_join;
/*
True if 'this' represents a nested join that is a NATURAL JOIN.
For one of the operands of 'this', the member 'natural_join' points