summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 0af1fb7b50a..ea8eaf6653e 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -3486,6 +3486,16 @@ ha_innobase::records_in_range(
prebuilt->trx->op_info = (char*)"";
+ /* The MySQL optimizer seems to believe an estimate of 0 rows is
+ always accurate and may return the result 'Empty set' based on that.
+ The accuracy is not guaranteed, and even if it were, for a locking
+ read we should anyway perform the search to set the next-key lock.
+ Add 1 to the value to make sure MySQL does not make the assumption! */
+
+ if (n_rows == 0) {
+ n_rows = 1;
+ }
+
DBUG_RETURN((ha_rows) n_rows);
}