Commit ccf98951 authored by unknown's avatar unknown

A separate, better error message when it's impossible to aggregate strings for some operation

parent 90c95b96
...@@ -276,4 +276,5 @@ ...@@ -276,4 +276,5 @@
#define ER_ZLIB_Z_DATA_ERROR 1257 #define ER_ZLIB_Z_DATA_ERROR 1257
#define ER_CUT_VALUE_GROUP_CONCAT 1258 #define ER_CUT_VALUE_GROUP_CONCAT 1258
#define ER_WARN_USING_OTHER_HANDLER 1259 #define ER_WARN_USING_OTHER_HANDLER 1259
#define ER_ERROR_MESSAGES 259 #define ER_CANT_AGGREGATE_COLLATIONS 1260
#define ER_ERROR_MESSAGES 260
...@@ -41,7 +41,18 @@ class Item { ...@@ -41,7 +41,18 @@ class Item {
enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE };
enum coercion { COER_COERCIBLE=3, COER_IMPLICIT=2, enum coercion { COER_COERCIBLE=3, COER_IMPLICIT=2,
COER_NOCOLL=1, COER_EXPLICIT=0 }; COER_NOCOLL=1, COER_EXPLICIT=0 };
const char *coercion_name(enum coercion coer) const
{
switch(coer)
{
case COER_COERCIBLE: return "COERCIBLE";
case COER_IMPLICIT: return "IMPLICIT";
case COER_EXPLICIT: return "EXPLICIT";
case COER_NOCOLL: return "NO COLLATION";
default: return "UNKNOWN";
}
}
String str_value; /* used to store value */ String str_value; /* used to store value */
my_string name; /* Name from select */ my_string name; /* Name from select */
Item *next; Item *next;
......
...@@ -170,7 +170,10 @@ void Item_bool_func2::fix_length_and_dec() ...@@ -170,7 +170,10 @@ void Item_bool_func2::fix_length_and_dec()
if (set_cmp_charset(args[0]->charset(), args[0]->coercibility, if (set_cmp_charset(args[0]->charset(), args[0]->coercibility,
args[1]->charset(), args[1]->coercibility)) args[1]->charset(), args[1]->coercibility))
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
args[0]->charset()->name,coercion_name(args[0]->coercibility),
args[1]->charset()->name,coercion_name(args[1]->coercibility),
func_name());
return; return;
} }
set_cmp_func(); set_cmp_func();
...@@ -652,7 +655,10 @@ Item_func_ifnull::fix_length_and_dec() ...@@ -652,7 +655,10 @@ Item_func_ifnull::fix_length_and_dec()
decimals= 0; decimals= 0;
if (set_charset(args[0]->charset(),args[0]->coercibility, if (set_charset(args[0]->charset(),args[0]->coercibility,
args[1]->charset(),args[1]->coercibility)) args[1]->charset(),args[1]->coercibility))
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
args[0]->charset()->name,coercion_name(args[0]->coercibility),
args[1]->charset()->name,coercion_name(args[1]->coercibility),
func_name());
} }
...@@ -731,7 +737,10 @@ Item_func_if::fix_length_and_dec() ...@@ -731,7 +737,10 @@ Item_func_if::fix_length_and_dec()
if (set_charset(args[1]->charset(), args[1]->coercibility, if (set_charset(args[1]->charset(), args[1]->coercibility,
args[2]->charset(), args[2]->coercibility)) args[2]->charset(), args[2]->coercibility))
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
args[0]->charset()->name,coercion_name(args[0]->coercibility),
args[1]->charset()->name,coercion_name(args[1]->coercibility),
func_name());
return; return;
} }
} }
...@@ -1878,7 +1887,10 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref) ...@@ -1878,7 +1887,10 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
if (set_cmp_charset(args[0]->charset(), args[0]->coercibility, if (set_cmp_charset(args[0]->charset(), args[0]->coercibility,
args[1]->charset(), args[1]->coercibility)) args[1]->charset(), args[1]->coercibility))
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
args[0]->charset()->name,coercion_name(args[0]->coercibility),
args[1]->charset()->name,coercion_name(args[1]->coercibility),
func_name());
return 1; return 1;
} }
......
...@@ -859,7 +859,10 @@ void Item_func_min_max::fix_length_and_dec() ...@@ -859,7 +859,10 @@ void Item_func_min_max::fix_length_and_dec()
else if (set_charset(charset(), coercibility, else if (set_charset(charset(), coercibility,
args[i]->charset(), args[i]->coercibility)) args[i]->charset(), args[i]->coercibility))
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
charset()->name,coercion_name(coercibility),
args[i]->charset()->name,coercion_name(args[i]->coercibility),
func_name());
break; break;
} }
} }
......
...@@ -326,7 +326,10 @@ void Item_func_concat::fix_length_and_dec() ...@@ -326,7 +326,10 @@ void Item_func_concat::fix_length_and_dec()
if (set_charset(charset(), coercibility, if (set_charset(charset(), coercibility,
args[i]->charset(), args[i]->coercibility)) args[i]->charset(), args[i]->coercibility))
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
charset()->name,coercion_name(coercibility),
args[i]->charset()->name,coercion_name(args[i]->coercibility),
func_name());
break; break;
} }
} }
...@@ -630,7 +633,10 @@ void Item_func_concat_ws::fix_length_and_dec() ...@@ -630,7 +633,10 @@ void Item_func_concat_ws::fix_length_and_dec()
if (set_charset(charset(), coercibility, if (set_charset(charset(), coercibility,
args[i]->charset(), args[i]->coercibility)) args[i]->charset(), args[i]->coercibility))
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
charset()->name,coercion_name(coercibility),
args[i]->charset()->name,coercion_name(args[i]->coercibility),
func_name());
break; break;
} }
} }
...@@ -1624,7 +1630,10 @@ void Item_func_elt::fix_length_and_dec() ...@@ -1624,7 +1630,10 @@ void Item_func_elt::fix_length_and_dec()
if (set_charset(charset(), coercibility, if (set_charset(charset(), coercibility,
args[i]->charset(), args[i]->coercibility)) args[i]->charset(), args[i]->coercibility))
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0),
charset()->name,coercion_name(coercibility),
args[i]->charset()->name,coercion_name(args[i]->coercibility),
func_name());
break; break;
} }
} }
......
...@@ -270,3 +270,4 @@ v/* ...@@ -270,3 +270,4 @@ v/*
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -264,3 +264,4 @@ ...@@ -264,3 +264,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -272,3 +272,4 @@ ...@@ -272,3 +272,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -261,3 +261,4 @@ ...@@ -261,3 +261,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -266,3 +266,4 @@ ...@@ -266,3 +266,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -261,3 +261,4 @@ ...@@ -261,3 +261,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -270,3 +270,4 @@ ...@@ -270,3 +270,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -261,3 +261,4 @@ ...@@ -261,3 +261,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -263,3 +263,4 @@ ...@@ -263,3 +263,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -261,3 +261,4 @@ ...@@ -261,3 +261,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -263,3 +263,4 @@ ...@@ -263,3 +263,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -261,3 +261,4 @@ ...@@ -261,3 +261,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -263,3 +263,4 @@ ...@@ -263,3 +263,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -263,3 +263,4 @@ ...@@ -263,3 +263,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -265,3 +265,4 @@ ...@@ -265,3 +265,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -261,3 +261,4 @@ ...@@ -261,3 +261,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -265,3 +265,4 @@ ...@@ -265,3 +265,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -263,3 +263,4 @@ ...@@ -263,3 +263,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -257,3 +257,4 @@ ...@@ -257,3 +257,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -269,3 +269,4 @@ ...@@ -269,3 +269,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -262,3 +262,4 @@ ...@@ -262,3 +262,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -261,3 +261,4 @@ ...@@ -261,3 +261,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d rad(er) kapades av group_concat()", "%d rad(er) kapades av group_concat()",
"Använder handler %s för tabell '%s'", "Använder handler %s för tabell '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
...@@ -266,3 +266,4 @@ ...@@ -266,3 +266,4 @@
"Z_DATA_ERROR: Input data was corrupted for zlib", "Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()", "%d line(s) was(were) cut by group_concat()",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
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