summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2014-10-28 22:31:52 -0700
committerIgor Babaev <igor@askmonty.org>2014-10-28 22:31:52 -0700
commit100b10d8efbcbc936d742b87aacf49dab037333f (patch)
tree33cd992dc65d7bd5d585f09169d1f14ac5929f53 /sql/sql_statistics.cc
parent2d088e265ce3ca0523846ec97c7b3b2c4e6cba67 (diff)
downloadmariadb-git-100b10d8efbcbc936d742b87aacf49dab037333f.tar.gz
Fixed bug mdev-6843.
The function get_column_range_cardinality() returned a wrong result for any column containing only null values.
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index a38df24cfb7..9807a26f772 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3502,7 +3502,12 @@ double get_column_range_cardinality(Field *field,
!(range_flag & NEAR_MIN);
if (col_non_nulls < 1)
- res= 0; /* this is likely wrong, see MDEV-6843 */
+ {
+ if (nulls_incl)
+ res= col_nulls;
+ else
+ res= 0;
+ }
else if (min_endp && max_endp && min_endp->length == max_endp->length &&
!memcmp(min_endp->key, max_endp->key, min_endp->length))
{