diff options
author | Alexander Barkov <bar@mariadb.org> | 2014-09-04 21:58:48 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2014-09-04 21:58:48 +0400 |
commit | 9392d0e280c622c56d1b533762d8b577ed5b82c6 (patch) | |
tree | 11dc8978b370ead259ae9eaa419e2a2710feaf73 /mysql-test | |
parent | bf4347eba07a7e8f11af07a684381d48d673e028 (diff) | |
download | mariadb-git-9392d0e280c622c56d1b533762d8b577ed5b82c6.tar.gz |
- MDEV-6695 Bad column name for UCS2 string literals
The Item_string constructors called set_name() on the source string,
which was wrong because in case of UCS2/UTF16/UTF32 the source value
might be a not well formed string (e.g. have incomplete leftmost character).
Now set_name() is called on str_value after its copied
(with optionally left zero padding) from the source string.
- MDEV-6694 Illegal mix of collation with a PS parameter
Item_param::convert_str_value() did not set repertoire.
Introducing a new structure MY_STRING_METADATA to collect
character length and repertoire of a string in a single loop,
to avoid two separate loops. Adding a new class Item_basic_value::Metadata
as a convenience wrapper around MY_STRING_METADATA, to reuse the
code between Item_string and Item_param.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/ctype_ucs.result | 7 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8.result | 23 | ||||
-rw-r--r-- | mysql-test/t/ctype_ucs.test | 7 | ||||
-rw-r--r-- | mysql-test/t/ctype_utf8.test | 18 |
4 files changed, 55 insertions, 0 deletions
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index a98295c10ce..3cfc076b8a0 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -5333,5 +5333,12 @@ SELECT CONCAT(CONVERT('pi=' USING ucs2),PI()) AS PI; PI pi=3.141593 # +# MDEV-6695 Bad column name for UCS2 string literals +# +SET NAMES utf8, character_set_connection=ucs2; +SELECT 'a','aa'; +a aa +a aa +# # End of 10.0 tests # diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 8a3fcd9dc0d..767f0b04b98 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -6008,5 +6008,28 @@ CONCAT(a, IF(b>10, _utf8 X'61', _utf8 B'01100001')) aa DROP TABLE t1; # +# MDEV-6694 Illegal mix of collation with a PS parameter +# +SET NAMES utf8; +CREATE TABLE t1 (a INT, b VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES (1,'a'); +SELECT CONCAT(b,IF(a,'b','b')) FROM t1; +CONCAT(b,IF(a,'b','b')) +ab +PREPARE stmt FROM "SELECT CONCAT(b,IF(a,?,?)) FROM t1"; +SET @b='b'; +EXECUTE stmt USING @b,@b; +CONCAT(b,IF(a,?,?)) +ab +SET @b=''; +EXECUTE stmt USING @b,@b; +CONCAT(b,IF(a,?,?)) +a +SET @b='я'; +EXECUTE stmt USING @b,@b; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# # End of 10.0 tests # diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 94d79494502..d269fb35dfe 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -903,5 +903,12 @@ DROP TABLE t1; SELECT CONCAT(CONVERT('pi=' USING ucs2),PI()) AS PI; --echo # +--echo # MDEV-6695 Bad column name for UCS2 string literals +--echo # +SET NAMES utf8, character_set_connection=ucs2; +SELECT 'a','aa'; + + +--echo # --echo # End of 10.0 tests --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 75630cf9cd5..eca1be2b4e7 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1719,6 +1719,24 @@ SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 X'61')) FROM t1; SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 B'01100001')) FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-6694 Illegal mix of collation with a PS parameter +--echo # +SET NAMES utf8; +CREATE TABLE t1 (a INT, b VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES (1,'a'); +SELECT CONCAT(b,IF(a,'b','b')) FROM t1; +PREPARE stmt FROM "SELECT CONCAT(b,IF(a,?,?)) FROM t1"; +SET @b='b'; +EXECUTE stmt USING @b,@b; +SET @b=''; +EXECUTE stmt USING @b,@b; +SET @b='я'; +--error ER_CANT_AGGREGATE_2COLLATIONS +EXECUTE stmt USING @b,@b; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + --echo # --echo # End of 10.0 tests |