From cbb90f77cdbf57c02145dc6cd86acf8ebb8a88f0 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Tue, 28 May 2019 23:26:36 -0700 Subject: MDEV-18479 Complement This patch complements the patch that fixes bug MDEV-18479. This patch takes care of possible overflow when calculating the estimated number of rows in a materialized derived table / view. --- sql/sql_lex.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 3e20cdb48da..28f56282bad 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -4100,7 +4100,10 @@ void SELECT_LEX::increase_derived_records(ha_rows records) DBUG_ASSERT(unit->derived); select_union *result= (select_union*)unit->result; - result->records+= records; + if (HA_ROWS_MAX - records > result->records) + result->records+= records; + else + result->records= HA_ROWS_MAX; } -- cgit v1.2.1