summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/include/have_cp1250_ch.inc4
-rw-r--r--mysql-test/r/ctype_cp1250_ch.result9
-rw-r--r--mysql-test/r/have_cp1250_ch.require2
-rw-r--r--mysql-test/t/ctype_cp1250_ch.test12
-rw-r--r--strings/ctype-win1250ch.c2
5 files changed, 28 insertions, 1 deletions
diff --git a/mysql-test/include/have_cp1250_ch.inc b/mysql-test/include/have_cp1250_ch.inc
new file mode 100644
index 00000000000..eec5d69fbd6
--- /dev/null
+++ b/mysql-test/include/have_cp1250_ch.inc
@@ -0,0 +1,4 @@
+-- require r/have_cp1250_ch.require
+disable_query_log;
+show collation like "cp1250_czech_cs";
+enable_query_log;
diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result
new file mode 100644
index 00000000000..62936b84caf
--- /dev/null
+++ b/mysql-test/r/ctype_cp1250_ch.result
@@ -0,0 +1,9 @@
+SHOW COLLATION LIKE 'cp1250_czech_cs';
+Collation Charset Id Default Compiled Sortlen
+cp1250_czech_cs cp1250 34 Yes 2
+CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
+INSERT INTO t1 VALUES ('');
+SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
+a length(a) a='' a=' ' a=' '
+ 0 1 1 1
+DROP TABLE t1;
diff --git a/mysql-test/r/have_cp1250_ch.require b/mysql-test/r/have_cp1250_ch.require
new file mode 100644
index 00000000000..2eb834d97e2
--- /dev/null
+++ b/mysql-test/r/have_cp1250_ch.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+cp1250_czech_cs cp1250 34 Yes 2
diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test
new file mode 100644
index 00000000000..06aea7b9979
--- /dev/null
+++ b/mysql-test/t/ctype_cp1250_ch.test
@@ -0,0 +1,12 @@
+-- source include/have_cp1250_ch.inc
+
+SHOW COLLATION LIKE 'cp1250_czech_cs';
+
+#
+# Bugs: #8840: Empty string comparison and character set 'cp1250'
+#
+
+CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
+INSERT INTO t1 VALUES ('');
+SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
+DROP TABLE t1;
diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c
index 98389a9a5a4..d843971b93f 100644
--- a/strings/ctype-win1250ch.c
+++ b/strings/ctype-win1250ch.c
@@ -416,7 +416,7 @@ static struct wordvalue doubles[] = {
#define NEXT_CMP_VALUE(src, p, pass, value, len) \
while (1) { \
if (IS_END(p, src, len)) { \
- if (pass == 0) { p = src; pass++; } \
+ if (pass == 0 && len > 0) { p= src; pass++; } \
else { value = 0; break; } \
} \
value = ((pass == 0) ? _sort_order_win1250ch1[*p] \