summaryrefslogtreecommitdiff
path: root/mysql-test/include/weight_string.inc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2013-10-25 15:01:03 +0400
committerAlexander Barkov <bar@mnogosearch.org>2013-10-25 15:01:03 +0400
commit71f8ca654eceea835d6330eb511ce41643dfaeb5 (patch)
tree2e87ceb27347664cd9317b7ba24a6cbc0f47749a /mysql-test/include/weight_string.inc
parenta6e28ce5e6a1cb2c5e4eaf9e900e7d6339094a75 (diff)
downloadmariadb-git-71f8ca654eceea835d6330eb511ce41643dfaeb5.tar.gz
MDEV-5180 Data type for WEIGHT_STRING is too short in some cases
(a bug in upstream)
Diffstat (limited to 'mysql-test/include/weight_string.inc')
-rw-r--r--mysql-test/include/weight_string.inc35
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/include/weight_string.inc b/mysql-test/include/weight_string.inc
index d8621a19687..1ae8801c560 100644
--- a/mysql-test/include/weight_string.inc
+++ b/mysql-test/include/weight_string.inc
@@ -1,4 +1,39 @@
select @@collation_connection;
+
+#
+# MDEV-5180 Data type for WEIGHT_STRING is too short in some cases
+#
+CREATE TABLE t1 AS SELECT 'a' AS a;
+SHOW CREATE TABLE t1;
+CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
+SHOW CREATE TABLE t2;
+SELECT HEX(WEIGHT_STRING(a)) FROM t1;
+SELECT HEX(ws) FROM t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
+SHOW CREATE TABLE t1;
+CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
+SHOW CREATE TABLE t2;
+SELECT HEX(WEIGHT_STRING(a)) FROM t1;
+SELECT HEX(ws) FROM t2;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
+SHOW CREATE TABLE t2;
+SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
+SELECT HEX(ws) FROM t2;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
+SHOW CREATE TABLE t2;
+SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
+SELECT HEX(ws) FROM t2;
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of MDEV-5180
+#
+
select hex(weight_string('a'));
select hex(weight_string('A'));
select hex(weight_string('abc'));