Commit c2a7768b authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

A new separate error message: Unknown collation 'blablabla'

parent 6a46d28e
...@@ -287,4 +287,5 @@ ...@@ -287,4 +287,5 @@
#define ER_CANT_AGGREGATE_3COLLATIONS 1268 #define ER_CANT_AGGREGATE_3COLLATIONS 1268
#define ER_CANT_AGGREGATE_NCOLLATIONS 1269 #define ER_CANT_AGGREGATE_NCOLLATIONS 1269
#define ER_VARIABLE_IS_NOT_STRUCT 1270 #define ER_VARIABLE_IS_NOT_STRUCT 1270
#define ER_ERROR_MESSAGES 271 #define ER_UNKNOWN_COLLATION 1271
#define ER_ERROR_MESSAGES 272
...@@ -7,6 +7,10 @@ CREATE TABLE t2 ( ...@@ -7,6 +7,10 @@ CREATE TABLE t2 (
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL
); );
ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1' ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
CREATE TABLE t2 (
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL
);
ERROR HY000: Unknown collation: 'some_non_existing_col'
INSERT INTO t1 (latin1_f) VALUES (_latin1'A'); INSERT INTO t1 (latin1_f) VALUES (_latin1'A');
INSERT INTO t1 (latin1_f) VALUES (_latin1'a'); INSERT INTO t1 (latin1_f) VALUES (_latin1'a');
INSERT INTO t1 (latin1_f) VALUES (_latin1'AD'); INSERT INTO t1 (latin1_f) VALUES (_latin1'AD');
...@@ -482,7 +486,7 @@ y ...@@ -482,7 +486,7 @@ y
Z Z
z z
SELECT DISTINCT latin1_f COLLATE koi8r FROM t1; SELECT DISTINCT latin1_f COLLATE koi8r FROM t1;
ERROR 42000: COLLATION 'koi8r' is not valid for CHARACTER SET 'latin1' ERROR HY000: Unknown collation: 'koi8r'
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -184,6 +184,8 @@ set GLOBAL table_type=DEFAULT; ...@@ -184,6 +184,8 @@ set GLOBAL table_type=DEFAULT;
ERROR 42000: Variable 'table_type' doesn't have a default value ERROR 42000: Variable 'table_type' doesn't have a default value
set character_set_client=UNKNOWN_CHARACTER_SET; set character_set_client=UNKNOWN_CHARACTER_SET;
ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET' ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET'
set collation_connection=UNKNOWN_COLLATION;
ERROR HY000: Unknown collation: 'UNKNOWN_COLLATION'
set global autocommit=1; set global autocommit=1;
ERROR HY000: Variable 'autocommit' is a LOCAL variable and can't be used with SET GLOBAL ERROR HY000: Variable 'autocommit' is a LOCAL variable and can't be used with SET GLOBAL
select @@global.timestamp; select @@global.timestamp;
......
...@@ -12,6 +12,11 @@ CREATE TABLE t2 ( ...@@ -12,6 +12,11 @@ CREATE TABLE t2 (
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL
); );
--error 1271
CREATE TABLE t2 (
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL
);
INSERT INTO t1 (latin1_f) VALUES (_latin1'A'); INSERT INTO t1 (latin1_f) VALUES (_latin1'A');
INSERT INTO t1 (latin1_f) VALUES (_latin1'a'); INSERT INTO t1 (latin1_f) VALUES (_latin1'a');
...@@ -93,7 +98,7 @@ SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1; ...@@ -93,7 +98,7 @@ SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1;
SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1;
SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1;
SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1;
--error 1251 --error 1271
SELECT DISTINCT latin1_f COLLATE koi8r FROM t1; SELECT DISTINCT latin1_f COLLATE koi8r FROM t1;
......
...@@ -120,6 +120,8 @@ set SESSION query_cache_size=10000; ...@@ -120,6 +120,8 @@ set SESSION query_cache_size=10000;
set GLOBAL table_type=DEFAULT; set GLOBAL table_type=DEFAULT;
--error 1115 --error 1115
set character_set_client=UNKNOWN_CHARACTER_SET; set character_set_client=UNKNOWN_CHARACTER_SET;
--error 1271
set collation_connection=UNKNOWN_COLLATION;
--error 1228 --error 1228
set global autocommit=1; set global autocommit=1;
--error 1228 --error 1228
......
...@@ -2206,7 +2206,13 @@ void Item_func_set_collation::fix_length_and_dec() ...@@ -2206,7 +2206,13 @@ void Item_func_set_collation::fix_length_and_dec()
set_collation= get_charset_by_csname(args[0]->charset()->csname, set_collation= get_charset_by_csname(args[0]->charset()->csname,
MY_CS_BINSORT,MYF(0)); MY_CS_BINSORT,MYF(0));
else else
set_collation= get_charset_by_name(colname,MYF(0)); {
if (!(set_collation= get_charset_by_name(colname,MYF(0))))
{
my_error(ER_UNKNOWN_COLLATION, MYF(0), colname);
return;
}
}
if (!set_collation || !my_charset_same(args[0]->charset(),set_collation)) if (!set_collation || !my_charset_same(args[0]->charset(),set_collation))
{ {
......
...@@ -1240,7 +1240,7 @@ bool sys_var_collation::check(THD *thd, set_var *var) ...@@ -1240,7 +1240,7 @@ bool sys_var_collation::check(THD *thd, set_var *var)
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0)))) if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr()); my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr());
return 1; return 1;
} }
var->save_result.charset= tmp; // Save for update var->save_result.charset= tmp; // Save for update
......
...@@ -276,3 +276,4 @@ v/* ...@@ -276,3 +276,4 @@ v/*
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -270,3 +270,4 @@ ...@@ -270,3 +270,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -278,3 +278,4 @@ ...@@ -278,3 +278,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -272,3 +272,4 @@ ...@@ -272,3 +272,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -272,3 +272,4 @@ ...@@ -272,3 +272,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -267,3 +267,4 @@ ...@@ -267,3 +267,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -276,3 +276,4 @@ ...@@ -276,3 +276,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -267,3 +267,4 @@ ...@@ -267,3 +267,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -269,3 +269,4 @@ ...@@ -269,3 +269,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -267,3 +267,4 @@ ...@@ -267,3 +267,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -269,3 +269,4 @@ ...@@ -269,3 +269,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -267,3 +267,4 @@ ...@@ -267,3 +267,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -269,3 +269,4 @@ ...@@ -269,3 +269,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -269,3 +269,4 @@ ...@@ -269,3 +269,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -271,3 +271,4 @@ ...@@ -271,3 +271,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -267,3 +267,4 @@ ...@@ -267,3 +267,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -271,3 +271,4 @@ ...@@ -271,3 +271,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -269,3 +269,4 @@ ...@@ -269,3 +269,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -263,3 +263,4 @@ ...@@ -263,3 +263,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -275,3 +275,4 @@ ...@@ -275,3 +275,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -268,3 +268,4 @@ ...@@ -268,3 +268,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -267,3 +267,4 @@ ...@@ -267,3 +267,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -272,3 +272,4 @@ ...@@ -272,3 +272,4 @@
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'",
...@@ -127,7 +127,7 @@ static bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create) ...@@ -127,7 +127,7 @@ static bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
{ {
if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0)))) if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0))))
{ {
sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1); sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
} }
} }
} }
......
...@@ -552,7 +552,7 @@ int yylex(void *arg, void *yythd) ...@@ -552,7 +552,7 @@ int yylex(void *arg, void *yythd)
/* /*
Note: "SELECT _bla AS 'alias'" Note: "SELECT _bla AS 'alias'"
_bla should be considered as a IDENT if charset haven't been found. _bla should be considered as a IDENT if charset haven't been found.
So we don't use MYF(MY_WME) with get_charset_by_name to avoid So we don't use MYF(MY_WME) with get_charset_by_csname to avoid
producing an error. producing an error.
*/ */
......
...@@ -1410,7 +1410,7 @@ collation_name: ...@@ -1410,7 +1410,7 @@ collation_name:
{ {
if (!($$=get_charset_by_name($1.str,MYF(0)))) if (!($$=get_charset_by_name($1.str,MYF(0))))
{ {
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); net_printf(YYTHD,ER_UNKNOWN_COLLATION,$1.str);
YYABORT; YYABORT;
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment