#At file:///home/bar/mysql-bzr/mysql-6.0-b37854/
2824 Alexander Barkov 2008-09-12
Bug#37854 Test fails/aborts for collate latin2_czech_cs used with SET and ENUM
Problem: my_strnncoll_czech() hunged when comparing two equal strings.
Loop didn't break on end-of-string (i.e. when NEXT_CMP_VALUE returned value=-1).
Fix: changing loop condition to break on negative values.
Extended comments for NEXT_CMP_VALUE were added.
modified:
mysql-test/r/ctype_latin2_ch.result
mysql-test/t/ctype_latin2_ch.test
strings/ctype-czech.c
=== modified file 'mysql-test/r/ctype_latin2_ch.result'
--- a/mysql-test/r/ctype_latin2_ch.result 2008-07-24 12:45:27 +0000
+++ b/mysql-test/r/ctype_latin2_ch.result 2008-09-12 11:49:17 +0000
@@ -763,3 +763,16 @@ z
Z
DROP TABLE t1;
SET NAMES latin2;
+CREATE TABLE t2(colours SET('red','blue','yellow'))CHARACTER SET latin2 COLLATE
+latin2_czech_cs;
+CREATE TABLE t1(continent ENUM('Asia', 'Europe','Africa','Antartica'))CHARACTER SET latin2
+COLLATE latin2_czech_cs;
+INSERT INTO t1 VALUES('Asia');
+INSERT INTO t2 VALUES('blue');
+SELECT * FROM t1;
+continent
+Asia
+SELECT * FROM t2;
+colours
+blue
+DROP TABLE t1, t2;
=== modified file 'mysql-test/t/ctype_latin2_ch.test'
--- a/mysql-test/t/ctype_latin2_ch.test 2008-07-24 12:45:27 +0000
+++ b/mysql-test/t/ctype_latin2_ch.test 2008-09-12 11:49:17 +0000
@@ -182,3 +182,16 @@ SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;
SET NAMES latin2;
+
+#
+# Bug#37854 Test fails/aborts for collate latin2_czech_cs used with SET and ENUM datatypes
+#
+CREATE TABLE t2(colours SET('red','blue','yellow'))CHARACTER SET latin2 COLLATE
+latin2_czech_cs;
+CREATE TABLE t1(continent ENUM('Asia', 'Europe','Africa','Antartica'))CHARACTER SET latin2
+COLLATE latin2_czech_cs;
+INSERT INTO t1 VALUES('Asia');
+INSERT INTO t2 VALUES('blue');
+SELECT * FROM t1;
+SELECT * FROM t2;
+DROP TABLE t1, t2;
=== modified file 'strings/ctype-czech.c'
--- a/strings/ctype-czech.c 2008-07-23 09:43:50 +0000
+++ b/strings/ctype-czech.c 2008-09-12 11:49:17 +0000
@@ -285,9 +285,21 @@ if ((totlen) < (len)) { dest[totlen] = v
#define IS_END(p, src, len) (((char *)p - (char *)src) >= (len))
/*
- ml - a flag indicating whether automatically
- switch to the secondary level,
- or stop on the primary level
+ src - IN pointer to the beginning of the string
+ p - IN/OUT pointer to the current character being processed
+ pass - IN pass number [0..3]
+ 0 - primary level
+ 1 - secondary level
+ 2 - tertiary level
+ 3 - quarternary level
+ value - OUT the next weight value.
+ -1 is returned on end-of-line.
+ 1 is returned between levels ("level separator").
+ Any value greater than 1 is a normal weight.
+ ml - IN a flag indicating whether to switch automatically
+ to the secondary level and higher levels,
+ or stop at the primary level.
+ ml=0 is used for prefix comparison.
*/
#define NEXT_CMP_VALUE(src, p, pass, value, len, ml) \
@@ -364,7 +376,7 @@ static int my_strnncoll_czech(CHARSET_IN
if ((diff = v1 - v2))
return diff;
}
- while (v1);
+ while (v1 >= 0);
return 0;
}
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (bar:2824) Bug#37854 | Alexander Barkov | 12 Sep |