diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2011-04-28 09:03:56 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2011-04-28 09:03:56 +0200 |
commit | ae154449f1617585e8c6237331fa8a3db4e674bb (patch) | |
tree | ffeeb2dc04f84be12ecd411057799864419c125e /mysql-test | |
parent | da0c7297ba55d8819ec35bd715e3b8e15339d849 (diff) | |
download | mariadb-git-ae154449f1617585e8c6237331fa8a3db4e674bb.tar.gz |
Bug#12340997 - DATE_ADD/DATE_SUB WITH INTERVAL CRASHES IN GET_INTERVAL_VALUE()
get_interval_value() was trying to parse the input string,
looking for leading '-' while skipping whitespace.
The macro my_isspace() does not work for utf16 character set,
since my_charset_utf16_general_ci.ctype == NULL.
Solution: convert input to ASCII before parsing.
mysql-test/r/ctype_utf16.result:
New test case.
mysql-test/t/ctype_utf16.test:
New test case.
sql/item_timefunc.cc:
Use val_string_ascii() rather than val_string()
so that we can safely use my_isspace() for skipping whitespace.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/ctype_utf16.result | 9 | ||||
-rw-r--r-- | mysql-test/t/ctype_utf16.test | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index ebb1bd443a2..dfffd8142de 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -1117,5 +1117,14 @@ CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END b DROP TABLE t1; # +# Bug#12340997 +# DATE_ADD/DATE_SUB WITH INTERVAL CRASHES IN GET_INTERVAL_VALUE() +# +SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second)); +space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second)) +NULL +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated +# # End of 5.5 tests # diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index 2f1651d0f40..4ac47a4ac53 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -755,6 +755,13 @@ INSERT INTO t1 VALUES ('a'); SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1; DROP TABLE t1; +--echo # +--echo # Bug#12340997 +--echo # DATE_ADD/DATE_SUB WITH INTERVAL CRASHES IN GET_INTERVAL_VALUE() +--echo # + +SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second)); + # ## TODO: add tests for all engines # |