diff options
author | Alexander Barkov <bar@mysql.com> | 2010-11-12 13:12:15 +0300 |
---|---|---|
committer | Alexander Barkov <bar@mysql.com> | 2010-11-12 13:12:15 +0300 |
commit | 1b583fa5da71a764dd66ad8b3668d7c75b122444 (patch) | |
tree | 857de10f04663e23de6cfb4be01edfbda425279e /mysql-test/t/date_formats.test | |
parent | aa668865e271694e9b3ebbfe518cb4d0c2ad0c38 (diff) | |
download | mariadb-git-1b583fa5da71a764dd66ad8b3668d7c75b122444.tar.gz |
Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr'
Problem: When GET_FORMAT() is called two times from the upper
level function (e.g. LEAST in the bug report), on the second
call "res= args[0]->val_str(...)" and str point to the same
String object.
1. Fix: changing the order from
- get val_str into tmp_value then convert to str
to
- get val_str into str then convert to tmp_value
The new order is more correct: the purpose of "str" parameter
is exactly to call val_str() for arguments.
The purpose of String class members (like tmp_value) is to do further
actions on the result.
Doing it in the other way around give unexpected surprises.
2. Using str_value instead of str to do padding, for the same reason.
Diffstat (limited to 'mysql-test/t/date_formats.test')
-rw-r--r-- | mysql-test/t/date_formats.test | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index e5dc7ffa53e..2a5de8ca9ba 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -359,3 +359,19 @@ SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date; SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; --echo "End of 5.0 tests" + + +--echo # +--echo # Start of 5.1 tests +--echo # + +--echo # +--echo # Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' +--echo # +SET NAMES utf8; +SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))); +SET NAMES latin1; + +--echo # +--echo # End of 5.1 tests +--echo # |