1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-17017 Explain for query using derived table specified with

a table value constructor shows wrong number of rows

This is another attempt to fix this bug. The previous patch did not take
into account that a transformation for ALL/ANY subqueries could be applied
to the materialized table that wrapped the table value constructor used as
a specification of the subselect used an ALL/ANY subquery. In this case
the result of the derived table used a sink of the class select_subselect
rather than of the class select_unit. Thus the previous fix could cause
memory overwrites when running EXPLAIN for queries with table value
constructors in ALL/ANY subselects.
This commit is contained in:
Igor Babaev
2018-08-27 08:12:59 -07:00
parent a290b807e8
commit 497d86276f
4 changed files with 6 additions and 9 deletions

View File

@ -4956,7 +4956,8 @@ protected:
SELECT_LEX_UNIT *unit;
/* Something used only by the parser: */
public:
select_result(THD *thd_arg): select_result_sink(thd_arg) {}
ha_rows est_records; /* estimated number of records in the result */
select_result(THD *thd_arg): select_result_sink(thd_arg), est_records(0) {}
void set_unit(SELECT_LEX_UNIT *unit_arg) { unit= unit_arg; }
virtual ~select_result() {};
/**
@ -5528,7 +5529,6 @@ public:
TMP_TABLE_PARAM tmp_table_param;
int write_err; /* Error code from the last send_data->ha_write_row call. */
TABLE *table;
ha_rows records;
select_unit(THD *thd_arg):
select_result_interceptor(thd_arg),
@ -5566,7 +5566,6 @@ public:
curr_sel= UINT_MAX;
step= UNION_TYPE;
write_err= 0;
records= 0;
}
void change_select();
};