summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <gluh@mysql.com>2005-05-09 16:22:49 +0000
committerunknown <gluh@mysql.com>2005-05-09 16:22:49 +0000
commitc6819bc64c9cb09615d16810c1fe5ddcf10bf962 (patch)
treea45c1df968541c9eb9aad9f95af0f3d89804be1c
parentfff3214a881ceb63799bff82a21b0ae7e75781a7 (diff)
downloadmariadb-git-c6819bc64c9cb09615d16810c1fe5ddcf10bf962.tar.gz
Fix for bug #9404: information_schema: Weird error messages with SELECT SUM() ... GROUP BY queries
heap/hp_hash.c: Fix for bug #9404: information_schema: Weird error messages with SELECT SUM() ... GROUP BY queries use length in symbols instead of length in bytes to calculate record length and key length
-rw-r--r--heap/hp_hash.c13
-rw-r--r--mysql-test/r/information_schema.result4
-rw-r--r--mysql-test/t/information_schema.test8
3 files changed, 17 insertions, 8 deletions
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index 52a250bd7af..7f02eb587a8 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -635,13 +635,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
key+= 2; /* skip key pack length */
if (cs->mbmaxlen > 1)
{
- uint char_length= seg->length / cs->mbmaxlen;
- char_length_key= my_charpos(cs, key, key + char_length_key,
- char_length);
- set_if_smaller(char_length_key, seg->length);
- char_length_rec= my_charpos(cs, pos, pos + char_length_rec,
- char_length);
- set_if_smaller(char_length_rec, seg->length);
+ uint char_length1, char_length2;
+ char_length1= char_length2= seg->length / cs->mbmaxlen;
+ char_length1= my_charpos(cs, key, key + char_length_key, char_length1);
+ set_if_smaller(char_length_key, char_length1);
+ char_length2= my_charpos(cs, pos, pos + char_length_rec, char_length2);
+ set_if_smaller(char_length_rec, char_length2);
}
if (cs->coll->strnncollsp(seg->charset,
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 0aa5e759207..6104fc772b4 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -734,3 +734,7 @@ x_real NULL NULL
x_float NULL NULL
x_double_precision NULL NULL
drop table t1;
+SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
+table_schema count(*)
+information_schema 15
+mysql 17
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 1739604372a..2da814526a2 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1,4 +1,4 @@
-# This test uses grants, which can't get tested for embedded server
+# This test uses grants, which can't get tested for embedded server
-- source include/not_embedded.inc
# Test for information_schema.schemata &
@@ -473,3 +473,9 @@ SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME= 't1';
drop table t1;
+
+#
+# Bug #9404 information_schema: Weird error messages
+# with SELECT SUM() ... GROUP BY queries
+#
+SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;