summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-05-28 23:26:36 -0700
committerIgor Babaev <igor@askmonty.org>2019-05-28 23:26:36 -0700
commitcbb90f77cdbf57c02145dc6cd86acf8ebb8a88f0 (patch)
treedd5a613a38a95a9a4f05144ac10e1b96c945a6ab /sql/sql_lex.cc
parenteb09580b67ee19f7ac30c1a41c8307b9c7d482d1 (diff)
downloadmariadb-git-cbb90f77cdbf57c02145dc6cd86acf8ebb8a88f0.tar.gz
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.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc5
1 files changed, 4 insertions, 1 deletions
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;
}