A follow-up for WL#5624: Collation customization improvements

The reasons for failures to initialize a user collation defined
in Index.xml are now correctly reported                                  
(in SHOW WARNINGS and in the server error log) if the COLLATE clause
is used with an expression, e.g.:

  SELECT <exrp> COLLATE <collation name> FROM t1;

Previously, the failure reasons were reported only by COLLATE clauses
in SET NAMES and in DDL statements, e.g.:

  SET NAMES utf8 COLLATE utf8_xxx_ci;
  CREATE TABLE t1 (a VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_xxx_ci);
This commit is contained in:
Alexander Barkov 2013-10-15 13:39:44 +04:00
parent a9240dce9e
commit ce069b1f6b
3 changed files with 13 additions and 6 deletions

View File

@ -769,6 +769,12 @@ SHOW WARNINGS;
Level Code Message
Error 1273 Unknown collation: 'utf8_5624_2'
Warning 1273 Syntax error at '[strength tertiary]'
SELECT _utf8'test' COLLATE utf8_5624_2;
ERROR HY000: Unknown collation: 'utf8_5624_2'
SHOW WARNINGS;
Level Code Message
Error 1273 Unknown collation: 'utf8_5624_2'
Warning 1273 Syntax error at '[strength tertiary]'
#
# WL#5624, reset before primary ignorable
#
@ -1086,4 +1092,4 @@ DROP TABLE t1;
# Bug#14197426 PARSE ERRORS IN LOADABLE UCA / LDML COLLATIONS ARE SILENTLY IGNORED
#
# Search for occurrences of [ERROR] Syntax error at '[strength tertiary]'
Occurances : 1
Occurances : 2

View File

@ -249,6 +249,10 @@ DROP TABLE t1;
SET NAMES utf8 COLLATE utf8_5624_2;
SHOW WARNINGS;
--error ER_UNKNOWN_COLLATION
SELECT _utf8'test' COLLATE utf8_5624_2;
SHOW WARNINGS;
--echo #
--echo # WL#5624, reset before primary ignorable
--echo #
@ -353,7 +357,7 @@ DROP TABLE t1;
--let $out_file= $MYSQLTEST_VARDIR/tmp/ctype_ldml_log.err
--let OUTF= $out_file
# Error messages are not seen in error log in embedded version
--let EMBEDDED=`SELECT version() LIKE '%embedded%'`
--let EMBEDDED=`SELECT IF(version() LIKE '%embedded%',2,0)`
--echo # Search for occurrences of [ERROR] Syntax error at '[strength tertiary]'
perl;

View File

@ -3463,11 +3463,8 @@ void Item_func_set_collation::fix_length_and_dec()
MY_CS_BINSORT,MYF(0));
else
{
if (!(set_collation= get_charset_by_name(colname,MYF(0))))
{
my_error(ER_UNKNOWN_COLLATION, MYF(0), colname);
if (!(set_collation= mysqld_collation_get_by_name(colname)))
return;
}
}
if (!set_collation ||