Commit f610296d authored by Michael Widenius's avatar Michael Widenius

Changed MariaDB error numbers to start from 1900 to not conflict with MySQL error numbers


extra/comp_err.c:
  Allow one to have multiple start-error-numbers in the same error.txt file.
  Generate 'empty' error strings for the missing error numbers in the errmsg.sys file
mysql-test/r/bigint.result:
  Update results to use new error numbers
mysql-test/r/dyncol.result:
  Update results to use new error numbers
mysql-test/r/func_math.result:
  Update results to use new error numbers
mysql-test/r/func_str.result:
  Update results to use new error numbers
mysql-test/r/plugin.result:
  Update results to use new error numbers
mysql-test/r/table_options.result:
  Update results to use new error numbers
mysql-test/r/type_newdecimal.result:
  Update results to use new error numbers
mysql-test/r/warnings.result:
  Update results to use new error numbers
mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result:
  Update results to use new error numbers
mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result:
  Update results to use new error numbers
mysql-test/suite/vcol/r/vcol_misc.result:
  Update results to use new error numbers
sql/derror.cc:
  Ensure we don't read a errmsg.sys with a missing required error message;  This change was needed as errmsg.sys may now contain empty error messages between the MySQL and MariaDB error messages.
  If error message file didn't exist and we have not read one in the past, don't continue.
  Give better error message if the errmsg.sys header has changed.
sql/share/errmsg.txt:
  Create new section, starting from 1900, for MariaDB error messages
parent be6d6e1b
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#define HEADER_LENGTH 32 /* Length of header in errmsg.sys */ #define HEADER_LENGTH 32 /* Length of header in errmsg.sys */
#define DEFAULT_CHARSET_DIR "../sql/share/charsets" #define DEFAULT_CHARSET_DIR "../sql/share/charsets"
#define ER_PREFIX "ER_" #define ER_PREFIX "ER_"
#define ER_PREFIX2 "MARIA_ER_"
#define WARN_PREFIX "WARN_" #define WARN_PREFIX "WARN_"
static char *OUTFILE= (char*) "errmsg.sys"; static char *OUTFILE= (char*) "errmsg.sys";
static char *HEADERFILE= (char*) "mysqld_error.h"; static char *HEADERFILE= (char*) "mysqld_error.h";
...@@ -57,7 +58,7 @@ const char *empty_string= ""; /* For empty states */ ...@@ -57,7 +58,7 @@ const char *empty_string= ""; /* For empty states */
*/ */
const char *default_language= "eng"; const char *default_language= "eng";
int er_offset= 1000; uint er_offset= 1000;
my_bool info_flag= 0; my_bool info_flag= 0;
/* Storage of one error message row (for one language) */ /* Storage of one error message row (for one language) */
...@@ -85,7 +86,7 @@ struct languages ...@@ -85,7 +86,7 @@ struct languages
struct errors struct errors
{ {
const char *er_name; /* Name of the error (ER_HASHCK) */ const char *er_name; /* Name of the error (ER_HASHCK) */
int d_code; /* Error code number */ uint d_code; /* Error code number */
const char *sql_code1; /* sql state */ const char *sql_code1; /* sql state */
const char *sql_code2; /* ODBC state */ const char *sql_code2; /* ODBC state */
struct errors *next_error; /* Pointer to next error */ struct errors *next_error; /* Pointer to next error */
...@@ -127,6 +128,7 @@ static struct my_option my_long_options[]= ...@@ -127,6 +128,7 @@ static struct my_option my_long_options[]=
}; };
static struct errors *generate_empty_message(uint dcode);
static struct languages *parse_charset_string(char *str); static struct languages *parse_charset_string(char *str);
static struct errors *parse_error_string(char *ptr, int er_count); static struct errors *parse_error_string(char *ptr, int er_count);
static struct message *parse_message_string(struct message *new_message, static struct message *parse_message_string(struct message *new_message,
...@@ -203,6 +205,7 @@ static int create_header_files(struct errors *error_head) ...@@ -203,6 +205,7 @@ static int create_header_files(struct errors *error_head)
uint er_last; uint er_last;
FILE *er_definef, *sql_statef, *er_namef; FILE *er_definef, *sql_statef, *er_namef;
struct errors *tmp_error; struct errors *tmp_error;
uint current_d_code;
DBUG_ENTER("create_header_files"); DBUG_ENTER("create_header_files");
LINT_INIT(er_last); LINT_INIT(er_last);
...@@ -228,13 +231,22 @@ static int create_header_files(struct errors *error_head) ...@@ -228,13 +231,22 @@ static int create_header_files(struct errors *error_head)
fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code); fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code);
current_d_code= error_head->d_code -1;
for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error) for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error)
{ {
/* /*
generating mysqld_error.h generating mysqld_error.h
fprintf() will automatically add \r on windows fprintf() will automatically add \r on windows
*/ */
fprintf(er_definef, "#define %s %d\n", tmp_error->er_name,
if (!tmp_error->er_name)
continue; /* Placeholder for gap */
if (tmp_error->d_code > current_d_code + 1)
fprintf(er_definef, "\n/* New section */\n\n");
current_d_code= tmp_error->d_code;
fprintf(er_definef, "#define %s %u\n", tmp_error->er_name,
tmp_error->d_code); tmp_error->d_code);
er_last= tmp_error->d_code; er_last= tmp_error->d_code;
...@@ -403,7 +415,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, ...@@ -403,7 +415,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
char *str, buff[1000]; char *str, buff[1000];
struct errors *current_error= 0, **tail_error= top_error; struct errors *current_error= 0, **tail_error= top_error;
struct message current_message; struct message current_message;
int rcount= 0; uint rcount= 0;
my_bool er_offset_found= 0;
DBUG_ENTER("parse_input_file"); DBUG_ENTER("parse_input_file");
*top_error= 0; *top_error= 0;
...@@ -424,11 +437,32 @@ static int parse_input_file(const char *file_name, struct errors **top_error, ...@@ -424,11 +437,32 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
} }
if (is_prefix(str, "start-error-number")) if (is_prefix(str, "start-error-number"))
{ {
if (!(er_offset= parse_error_offset(str))) uint tmp_er_offset;
if (!(tmp_er_offset= parse_error_offset(str)))
{ {
fprintf(stderr, "Failed to parse the error offset string!\n"); fprintf(stderr, "Failed to parse the error offset string!\n");
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (!er_offset_found)
{
er_offset_found= 1;
er_offset= tmp_er_offset;
}
else
{
/* Create empty error messages between er_offset and tmp_err_offset */
if (tmp_er_offset < er_offset + rcount)
{
fprintf(stderr, "new start-error-number %u is smaller than current error message: %u\n", tmp_er_offset, er_offset + rcount);
DBUG_RETURN(0);
}
for ( ; er_offset + rcount < tmp_er_offset ; rcount++)
{
current_error= generate_empty_message(er_offset + rcount);
*tail_error= current_error;
tail_error= &current_error->next_error;
}
}
continue; continue;
} }
if (is_prefix(str, "default-language")) if (is_prefix(str, "default-language"))
...@@ -475,7 +509,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, ...@@ -475,7 +509,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
DBUG_RETURN(0); DBUG_RETURN(0);
continue; continue;
} }
if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX)) if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX) ||
is_prefix(str, ER_PREFIX2))
{ {
if (!(current_error= parse_error_string(str, rcount))) if (!(current_error= parse_error_string(str, rcount)))
{ {
...@@ -490,12 +525,12 @@ static int parse_input_file(const char *file_name, struct errors **top_error, ...@@ -490,12 +525,12 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
continue; continue;
} }
if (*str == '#' || *str == '\n') if (*str == '#' || *str == '\n')
continue; /* skip comment or empty lines */ continue; /* skip comment or empty lines */
fprintf(stderr, "Wrong input file format. Stop!\nLine: %s\n", str); fprintf(stderr, "Wrong input file format. Stop!\nLine: %s\n", str);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
*tail_error= 0; /* Mark end of list */ *tail_error= 0; /* Mark end of list */
my_fclose(file, MYF(0)); my_fclose(file, MYF(0));
DBUG_RETURN(rcount); DBUG_RETURN(rcount);
...@@ -604,7 +639,6 @@ static struct message *find_message(struct errors *err, const char *lang, ...@@ -604,7 +639,6 @@ static struct message *find_message(struct errors *err, const char *lang,
DBUG_RETURN(tmp); DBUG_RETURN(tmp);
if (!strcmp(tmp->lang_short_name, default_language)) if (!strcmp(tmp->lang_short_name, default_language))
{ {
DBUG_ASSERT(tmp->text[0] != 0);
return_val= tmp; return_val= tmp;
} }
} }
...@@ -824,6 +858,32 @@ static struct message *parse_message_string(struct message *new_message, ...@@ -824,6 +858,32 @@ static struct message *parse_message_string(struct message *new_message,
} }
static struct errors *generate_empty_message(uint d_code)
{
struct errors *new_error;
struct message message;
/* create a new element */
if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error),
MYF(MY_WME))))
return(0);
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1))
return(0); /* OOM: Fatal error */
new_error->d_code= d_code;
new_error->sql_code1= empty_string;
new_error->sql_code2= empty_string;
if (!(message.lang_short_name= my_strdup(default_language, MYF(MY_WME))) ||
!(message.text= my_strdup("", MYF(MY_WME))))
return(0);
/* Can't fail as msg is preallocated */
(void) insert_dynamic(&new_error->msg, (uchar*) &message);
return(new_error);
}
/* /*
Parsing the string with error name and codes; returns the pointer to Parsing the string with error name and codes; returns the pointer to
the errors struct the errors struct
...@@ -836,7 +896,9 @@ static struct errors *parse_error_string(char *str, int er_count) ...@@ -836,7 +896,9 @@ static struct errors *parse_error_string(char *str, int er_count)
DBUG_PRINT("enter", ("str: %s", str)); DBUG_PRINT("enter", ("str: %s", str));
/* create a new element */ /* create a new element */
new_error= (struct errors *) my_malloc(sizeof(*new_error), MYF(MY_WME)); if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error),
MYF(MY_WME))))
DBUG_RETURN(0);
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0)) if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0))
DBUG_RETURN(0); /* OOM: Fatal error */ DBUG_RETURN(0); /* OOM: Fatal error */
...@@ -966,7 +1028,7 @@ static struct languages *parse_charset_string(char *str) ...@@ -966,7 +1028,7 @@ static struct languages *parse_charset_string(char *str)
static void print_version(void) static void print_version(void)
{ {
DBUG_ENTER("print_version"); DBUG_ENTER("print_version");
printf("%s (Compile errormessage) Ver %s\n", my_progname, "2.0"); printf("%s (Compile errormessage) Ver %s\n", my_progname, "3.0");
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -362,12 +362,12 @@ select cast(19999999999999999999 as signed); ...@@ -362,12 +362,12 @@ select cast(19999999999999999999 as signed);
cast(19999999999999999999 as signed) cast(19999999999999999999 as signed)
9223372036854775807 9223372036854775807
Warnings: Warnings:
Error 1657 Got overflow when converting '19999999999999999999' to INT. Value truncated. Error 1916 Got overflow when converting '19999999999999999999' to INT. Value truncated.
select cast(-19999999999999999999 as signed); select cast(-19999999999999999999 as signed);
cast(-19999999999999999999 as signed) cast(-19999999999999999999 as signed)
-9223372036854775808 -9223372036854775808
Warnings: Warnings:
Error 1657 Got overflow when converting '-19999999999999999999' to INT. Value truncated. Error 1916 Got overflow when converting '-19999999999999999999' to INT. Value truncated.
select -9223372036854775808; select -9223372036854775808;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def -9223372036854775808 8 20 20 N 32897 0 63 def -9223372036854775808 8 20 20 N 32897 0 63
......
...@@ -47,7 +47,7 @@ select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int)); ...@@ -47,7 +47,7 @@ select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int));
hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int)) hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int))
000100010001FFFFFFFFFFFFFF7F 000100010001FFFFFFFFFFFFFF7F
Warnings: Warnings:
Error 1657 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated. Error 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated.
select hex(COLUMN_CREATE(1, NULL AS int)); select hex(COLUMN_CREATE(1, NULL AS int));
hex(COLUMN_CREATE(1, NULL AS int)) hex(COLUMN_CREATE(1, NULL AS int))
000000 000000
...@@ -73,7 +73,7 @@ select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int)); ...@@ -73,7 +73,7 @@ select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int));
hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int)) hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int))
000100010000FEFFFFFFFFFFFFFF 000100010000FEFFFFFFFFFFFFFF
Warnings: Warnings:
Error 1657 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated. Error 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated.
select hex(COLUMN_CREATE(1, NULL AS double)); select hex(COLUMN_CREATE(1, NULL AS double));
hex(COLUMN_CREATE(1, NULL AS double)) hex(COLUMN_CREATE(1, NULL AS double))
000000 000000
...@@ -223,7 +223,7 @@ select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 ...@@ -223,7 +223,7 @@ select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1
column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as unsigned int) column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as unsigned int)
18446744073709551615 18446744073709551615
Warnings: Warnings:
Error 1657 Got overflow when converting '99999999999999999999999999999' to UNSIGNED INT. Value truncated. Error 1916 Got overflow when converting '99999999999999999999999999999' to UNSIGNED INT. Value truncated.
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int); select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int);
column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int) column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int)
1000 1000
...@@ -231,12 +231,12 @@ select column_get(column_create(1, -1 AS decimal), 1 as unsigned int); ...@@ -231,12 +231,12 @@ select column_get(column_create(1, -1 AS decimal), 1 as unsigned int);
column_get(column_create(1, -1 AS decimal), 1 as unsigned int) column_get(column_create(1, -1 AS decimal), 1 as unsigned int)
0 0
Warnings: Warnings:
Error 1657 Got overflow when converting '-1' to UNSIGNED INT. Value truncated. Error 1916 Got overflow when converting '-1' to UNSIGNED INT. Value truncated.
select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int); select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int);
column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int) column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int)
18446744073709551615 18446744073709551615
Warnings: Warnings:
Warning 1657 Got overflow when converting '1e+29' to UNSIGNED INT. Value truncated. Warning 1916 Got overflow when converting '1e+29' to UNSIGNED INT. Value truncated.
select column_get(column_create(1, 999.9 AS double), 1 as unsigned int); select column_get(column_create(1, 999.9 AS double), 1 as unsigned int);
column_get(column_create(1, 999.9 AS double), 1 as unsigned int) column_get(column_create(1, 999.9 AS double), 1 as unsigned int)
1000 1000
...@@ -244,12 +244,12 @@ select column_get(column_create(1, -1 AS double), 1 as unsigned int); ...@@ -244,12 +244,12 @@ select column_get(column_create(1, -1 AS double), 1 as unsigned int);
column_get(column_create(1, -1 AS double), 1 as unsigned int) column_get(column_create(1, -1 AS double), 1 as unsigned int)
0 0
Warnings: Warnings:
Warning 1657 Got overflow when converting '-1' to UNSIGNED INT. Value truncated. Warning 1916 Got overflow when converting '-1' to UNSIGNED INT. Value truncated.
select column_get(column_create(1, "1212III" AS char), 1 as unsigned int); select column_get(column_create(1, "1212III" AS char), 1 as unsigned int);
column_get(column_create(1, "1212III" AS char), 1 as unsigned int) column_get(column_create(1, "1212III" AS char), 1 as unsigned int)
1212 1212
Warnings: Warnings:
Warning 1659 Encountered illegal value '1212III' when converting to UNSIGNED INT Warning 1918 Encountered illegal value '1212III' when converting to UNSIGNED INT
# #
# column get int # column get int
# #
...@@ -308,12 +308,12 @@ select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 ...@@ -308,12 +308,12 @@ select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1
column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as int) column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as int)
9223372036854775807 9223372036854775807
Warnings: Warnings:
Error 1657 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated. Error 1916 Got overflow when converting '99999999999999999999999999999' to INT. Value truncated.
select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int); select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int);
column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int) column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int)
-9223372036854775808 -9223372036854775808
Warnings: Warnings:
Error 1657 Got overflow when converting '-99999999999999999999999999999' to INT. Value truncated. Error 1916 Got overflow when converting '-99999999999999999999999999999' to INT. Value truncated.
select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int); select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int);
column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int) column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int)
1000 1000
...@@ -324,17 +324,17 @@ select column_get(column_create(1, -99999999999999999999999999999 AS double), 1 ...@@ -324,17 +324,17 @@ select column_get(column_create(1, -99999999999999999999999999999 AS double), 1
column_get(column_create(1, -99999999999999999999999999999 AS double), 1 as int) column_get(column_create(1, -99999999999999999999999999999 AS double), 1 as int)
-9223372036854775808 -9223372036854775808
Warnings: Warnings:
Warning 1657 Got overflow when converting '-1e+29' to INT. Value truncated. Warning 1916 Got overflow when converting '-1e+29' to INT. Value truncated.
select column_get(column_create(1, "-1212III" AS char), 1 as int); select column_get(column_create(1, "-1212III" AS char), 1 as int);
column_get(column_create(1, "-1212III" AS char), 1 as int) column_get(column_create(1, "-1212III" AS char), 1 as int)
-1212 -1212
Warnings: Warnings:
Warning 1659 Encountered illegal value '-1212III' when converting to INT Warning 1918 Encountered illegal value '-1212III' when converting to INT
select column_get(column_create(1, "1212III" AS char), 1 as int); select column_get(column_create(1, "1212III" AS char), 1 as int);
column_get(column_create(1, "1212III" AS char), 1 as int) column_get(column_create(1, "1212III" AS char), 1 as int)
1212 1212
Warnings: Warnings:
Warning 1659 Encountered illegal value '1212III' when converting to INT Warning 1918 Encountered illegal value '1212III' when converting to INT
select column_get(COLUMN_CREATE(1, ~0), 1 as signed); select column_get(COLUMN_CREATE(1, ~0), 1 as signed);
column_get(COLUMN_CREATE(1, ~0), 1 as signed) column_get(COLUMN_CREATE(1, ~0), 1 as signed)
-1 -1
...@@ -461,12 +461,12 @@ select column_get(column_create(1, "1223.5aa" AS char), 1 as double); ...@@ -461,12 +461,12 @@ select column_get(column_create(1, "1223.5aa" AS char), 1 as double);
column_get(column_create(1, "1223.5aa" AS char), 1 as double) column_get(column_create(1, "1223.5aa" AS char), 1 as double)
1223.5 1223.5
Warnings: Warnings:
Warning 1659 Encountered illegal value '1223.5aa' when converting to DOUBLE Warning 1918 Encountered illegal value '1223.5aa' when converting to DOUBLE
select column_get(column_create(1, "aa" AS char), 1 as double); select column_get(column_create(1, "aa" AS char), 1 as double);
column_get(column_create(1, "aa" AS char), 1 as double) column_get(column_create(1, "aa" AS char), 1 as double)
0 0
Warnings: Warnings:
Warning 1659 Encountered illegal value 'aa' when converting to DOUBLE Warning 1918 Encountered illegal value 'aa' when converting to DOUBLE
select column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2)); select column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2));
column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2)) column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2))
999.99 999.99
...@@ -530,12 +530,12 @@ select column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10)); ...@@ -530,12 +530,12 @@ select column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10));
column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10)) column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10))
1223.5000000000 1223.5000000000
Warnings: Warnings:
Warning 1659 Encountered illegal value '1223.5aa' when converting to DECIMAL Warning 1918 Encountered illegal value '1223.5aa' when converting to DECIMAL
select column_get(column_create(1, "aa" AS char), 1 as decimal(32,10)); select column_get(column_create(1, "aa" AS char), 1 as decimal(32,10));
column_get(column_create(1, "aa" AS char), 1 as decimal(32,10)) column_get(column_create(1, "aa" AS char), 1 as decimal(32,10))
0.0000000000 0.0000000000
Warnings: Warnings:
Warning 1659 Encountered illegal value 'aa' when converting to DECIMAL Warning 1918 Encountered illegal value 'aa' when converting to DECIMAL
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal); select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal);
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal) column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal)
9999999999 9999999999
...@@ -671,17 +671,17 @@ select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as d ...@@ -671,17 +671,17 @@ select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as d
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime) column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime)
NULL NULL
Warnings: Warnings:
Warning 1659 Encountered illegal value '18446744073709551615' when converting to DATE or DATETIME Warning 1918 Encountered illegal value '18446744073709551615' when converting to DATE or DATETIME
select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime); select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime);
column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime) column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime)
NULL NULL
Warnings: Warnings:
Warning 1659 Encountered illegal value '9223372036854775807' when converting to DATE or DATETIME Warning 1918 Encountered illegal value '9223372036854775807' when converting to DATE or DATETIME
select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime); select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime);
column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime) column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime)
NULL NULL
Warnings: Warnings:
Warning 1659 Encountered illegal value '-9223372036854775808' when converting to DATE or DATETIME Warning 1918 Encountered illegal value '-9223372036854775808' when converting to DATE or DATETIME
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime); select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime);
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime) column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime)
NULL NULL
...@@ -801,17 +801,17 @@ select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as d ...@@ -801,17 +801,17 @@ select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as d
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date) column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date)
NULL NULL
Warnings: Warnings:
Warning 1659 Encountered illegal value '18446744073709551615' when converting to DATE or DATETIME Warning 1918 Encountered illegal value '18446744073709551615' when converting to DATE or DATETIME
select column_get(column_create(1, 9223372036854775807 AS int), 1 as date); select column_get(column_create(1, 9223372036854775807 AS int), 1 as date);
column_get(column_create(1, 9223372036854775807 AS int), 1 as date) column_get(column_create(1, 9223372036854775807 AS int), 1 as date)
NULL NULL
Warnings: Warnings:
Warning 1659 Encountered illegal value '9223372036854775807' when converting to DATE or DATETIME Warning 1918 Encountered illegal value '9223372036854775807' when converting to DATE or DATETIME
select column_get(column_create(1, -9223372036854775808 AS int), 1 as date); select column_get(column_create(1, -9223372036854775808 AS int), 1 as date);
column_get(column_create(1, -9223372036854775808 AS int), 1 as date) column_get(column_create(1, -9223372036854775808 AS int), 1 as date)
NULL NULL
Warnings: Warnings:
Warning 1659 Encountered illegal value '-9223372036854775808' when converting to DATE or DATETIME Warning 1918 Encountered illegal value '-9223372036854775808' when converting to DATE or DATETIME
select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date); select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date);
column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date) column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date)
NULL NULL
......
...@@ -516,7 +516,7 @@ SELECT -9999999999999999991 DIV -1; ...@@ -516,7 +516,7 @@ SELECT -9999999999999999991 DIV -1;
-9999999999999999991 DIV -1 -9999999999999999991 DIV -1
-9223372036854775808 -9223372036854775808
Warnings: Warnings:
Error 1657 Got overflow when converting '-9999999999999999991' to INT. Value truncated. Error 1916 Got overflow when converting '-9999999999999999991' to INT. Value truncated.
SELECT -9223372036854775808 DIV -1; SELECT -9223372036854775808 DIV -1;
-9223372036854775808 DIV -1 -9223372036854775808 DIV -1
-9223372036854775808 -9223372036854775808
......
This diff is collapsed.
...@@ -75,9 +75,9 @@ SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; ...@@ -75,9 +75,9 @@ SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
#illegal value fixed #illegal value fixed
CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS; CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS;
Warnings: Warnings:
Warning 1653 Incorrect value '10000000000000000000' for option 'ULL' Warning 1912 Incorrect value '10000000000000000000' for option 'ULL'
Warning 1653 Incorrect value 'ttt' for option 'one_or_two' Warning 1912 Incorrect value 'ttt' for option 'one_or_two'
Warning 1653 Incorrect value 'SSS' for option 'YESNO' Warning 1912 Incorrect value 'SSS' for option 'YESNO'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -3,9 +3,9 @@ SET @OLD_SQL_MODE=@@SQL_MODE; ...@@ -3,9 +3,9 @@ SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1'; create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1';
Warnings: Warnings:
Warning 1652 Unknown option 'fkey' Warning 1911 Unknown option 'fkey'
Warning 1652 Unknown option 'dff' Warning 1911 Unknown option 'dff'
Warning 1652 Unknown option 'tkey1' Warning 1911 Unknown option 'tkey1'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -16,10 +16,10 @@ drop table t1; ...@@ -16,10 +16,10 @@ drop table t1;
#reassiginig options in the same line #reassiginig options in the same line
create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1; create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1;
Warnings: Warnings:
Warning 1652 Unknown option 'fkey' Warning 1911 Unknown option 'fkey'
Warning 1652 Unknown option 'dff' Warning 1911 Unknown option 'dff'
Warning 1652 Unknown option 'tkey1' Warning 1911 Unknown option 'tkey1'
Warning 1652 Unknown option 'tkey2' Warning 1911 Unknown option 'tkey2'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` ( ...@@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` (
#add option #add option
alter table t1 tkey4=4v1; alter table t1 tkey4=4v1;
Warnings: Warnings:
Warning 1652 Unknown option 'tkey4' Warning 1911 Unknown option 'tkey4'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -39,8 +39,8 @@ t1 CREATE TABLE `t1` ( ...@@ -39,8 +39,8 @@ t1 CREATE TABLE `t1` (
#remove options #remove options
alter table t1 tkey3=DEFAULT tkey4=DEFAULT; alter table t1 tkey3=DEFAULT tkey4=DEFAULT;
Warnings: Warnings:
Warning 1652 Unknown option 'tkey3' Warning 1911 Unknown option 'tkey3'
Warning 1652 Unknown option 'tkey4' Warning 1911 Unknown option 'tkey4'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -50,11 +50,11 @@ t1 CREATE TABLE `t1` ( ...@@ -50,11 +50,11 @@ t1 CREATE TABLE `t1` (
drop table t1; drop table t1;
create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1; create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1;
Warnings: Warnings:
Warning 1652 Unknown option 'fkey1' Warning 1911 Unknown option 'fkey1'
Warning 1652 Unknown option 'kkey1' Warning 1911 Unknown option 'kkey1'
Warning 1652 Unknown option 'TKEY1' Warning 1911 Unknown option 'TKEY1'
Warning 1652 Unknown option 'tkey2' Warning 1911 Unknown option 'tkey2'
Warning 1652 Unknown option 'tkey3' Warning 1911 Unknown option 'tkey3'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -64,7 +64,7 @@ t1 CREATE TABLE `t1` ( ...@@ -64,7 +64,7 @@ t1 CREATE TABLE `t1` (
#change field with option with the same value #change field with option with the same value
alter table t1 change a a int `FKEY1`='v1'; alter table t1 change a a int `FKEY1`='v1';
Warnings: Warnings:
Warning 1652 Unknown option 'FKEY1' Warning 1911 Unknown option 'FKEY1'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( ...@@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` (
#change field with option with a different value #change field with option with a different value
alter table t1 change a a int fkey1=v2; alter table t1 change a a int fkey1=v2;
Warnings: Warnings:
Warning 1652 Unknown option 'fkey1' Warning 1911 Unknown option 'fkey1'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` ( ...@@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` (
#new key with options #new key with options
alter table t1 add key bkey (b) kkey2=v1; alter table t1 add key bkey (b) kkey2=v1;
Warnings: Warnings:
Warning 1652 Unknown option 'kkey2' Warning 1911 Unknown option 'kkey2'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -105,8 +105,8 @@ t1 CREATE TABLE `t1` ( ...@@ -105,8 +105,8 @@ t1 CREATE TABLE `t1` (
#new column with options #new column with options
alter table t1 add column c int fkey1=v1 fkey2=v2; alter table t1 add column c int fkey1=v1 fkey2=v2;
Warnings: Warnings:
Warning 1652 Unknown option 'fkey1' Warning 1911 Unknown option 'fkey1'
Warning 1652 Unknown option 'fkey2' Warning 1911 Unknown option 'fkey2'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -141,7 +141,7 @@ t1 CREATE TABLE `t1` ( ...@@ -141,7 +141,7 @@ t1 CREATE TABLE `t1` (
#add column with options after delete #add column with options after delete
alter table t1 add column b int fkey2=v1; alter table t1 add column b int fkey2=v1;
Warnings: Warnings:
Warning 1652 Unknown option 'fkey2' Warning 1911 Unknown option 'fkey2'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -154,7 +154,7 @@ t1 CREATE TABLE `t1` ( ...@@ -154,7 +154,7 @@ t1 CREATE TABLE `t1` (
#add key #add key
alter table t1 add key bkey (b) kkey2=v2; alter table t1 add key bkey (b) kkey2=v2;
Warnings: Warnings:
Warning 1652 Unknown option 'kkey2' Warning 1911 Unknown option 'kkey2'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -168,7 +168,7 @@ t1 CREATE TABLE `t1` ( ...@@ -168,7 +168,7 @@ t1 CREATE TABLE `t1` (
drop table t1; drop table t1;
create table t1 (a int) tkey1=100; create table t1 (a int) tkey1=100;
Warnings: Warnings:
Warning 1652 Unknown option 'tkey1' Warning 1911 Unknown option 'tkey1'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -838,12 +838,12 @@ select 9999999999999999999999999999999999999999999999999999999999999999999999999 ...@@ -838,12 +838,12 @@ select 9999999999999999999999999999999999999999999999999999999999999999999999999
x x
99999999999999999999999999999999999999999999999999999999999999999 99999999999999999999999999999999999999999999999999999999999999999
Warnings: Warnings:
Error 1657 Got overflow when converting '' to DECIMAL. Value truncated. Error 1916 Got overflow when converting '' to DECIMAL. Value truncated.
select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x; select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x;
x x
100000000000000000000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000000000000000000000000
Warnings: Warnings:
Error 1657 Got overflow when converting '' to DECIMAL. Value truncated. Error 1916 Got overflow when converting '' to DECIMAL. Value truncated.
select 0.190287977636363637 + 0.040372670 * 0 - 0; select 0.190287977636363637 + 0.040372670 * 0 - 0;
0.190287977636363637 + 0.040372670 * 0 - 0 0.190287977636363637 + 0.040372670 * 0 - 0
0.190287977636363637 0.190287977636363637
...@@ -1380,15 +1380,15 @@ create table t1 (c1 decimal(64)); ...@@ -1380,15 +1380,15 @@ create table t1 (c1 decimal(64));
insert into t1 values( insert into t1 values(
89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); 89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
Warnings: Warnings:
Error 1657 Got overflow when converting '' to DECIMAL. Value truncated. Error 1916 Got overflow when converting '' to DECIMAL. Value truncated.
Warning 1264 Out of range value for column 'c1' at row 1 Warning 1264 Out of range value for column 'c1' at row 1
insert into t1 values( insert into t1 values(
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999); 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
Warnings: Warnings:
Error 1657 Got overflow when converting '' to DECIMAL. Value truncated. Error 1916 Got overflow when converting '' to DECIMAL. Value truncated.
Error 1657 Got overflow when converting '' to DECIMAL. Value truncated. Error 1916 Got overflow when converting '' to DECIMAL. Value truncated.
Error 1657 Got overflow when converting '' to DECIMAL. Value truncated. Error 1916 Got overflow when converting '' to DECIMAL. Value truncated.
Warning 1264 Out of range value for column 'c1' at row 1 Warning 1264 Out of range value for column 'c1' at row 1
insert into t1 values(1e100); insert into t1 values(1e100);
Warnings: Warnings:
...@@ -1432,7 +1432,7 @@ select cast(19999999999999999999 as unsigned); ...@@ -1432,7 +1432,7 @@ select cast(19999999999999999999 as unsigned);
cast(19999999999999999999 as unsigned) cast(19999999999999999999 as unsigned)
18446744073709551615 18446744073709551615
Warnings: Warnings:
Error 1657 Got overflow when converting '19999999999999999999' to UNSIGNED INT. Value truncated. Error 1916 Got overflow when converting '19999999999999999999' to UNSIGNED INT. Value truncated.
create table t1(a decimal(18)); create table t1(a decimal(18));
insert into t1 values(123456789012345678); insert into t1 values(123456789012345678);
alter table t1 modify column a decimal(19); alter table t1 modify column a decimal(19);
...@@ -1674,7 +1674,7 @@ CREATE TABLE t1 SELECT ...@@ -1674,7 +1674,7 @@ CREATE TABLE t1 SELECT
/* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
AS c1; AS c1;
Warnings: Warnings:
Error 1657 Got overflow when converting '' to DECIMAL. Value truncated. Error 1916 Got overflow when converting '' to DECIMAL. Value truncated.
DESC t1; DESC t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
c1 decimal(65,0) NO 0 c1 decimal(65,0) NO 0
......
...@@ -324,7 +324,7 @@ select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t; ...@@ -324,7 +324,7 @@ select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
CAST(a AS DECIMAL(13,5)) CAST(a AS DECIMAL(13,5))
0.00000 0.00000
Warnings: Warnings:
Error 1659 Encountered illegal value '' when converting to DECIMAL Error 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: ''
create table t1 (a integer unsigned); create table t1 (a integer unsigned);
insert into t1 values (1),(-1),(0),(-2); insert into t1 values (1),(-1),(0),(-2);
......
...@@ -25,8 +25,8 @@ a b c ...@@ -25,8 +25,8 @@ a b c
# INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols # INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols
insert into t1 values (1,2,3); insert into t1 values (1,2,3);
Warnings: Warnings:
Warning 1647 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored
Warning 1647 The value specified for computed column 'c' in table 't1' ignored Warning 1906 The value specified for computed column 'c' in table 't1' ignored
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
...@@ -65,8 +65,8 @@ a b c ...@@ -65,8 +65,8 @@ a b c
# against vcols # against vcols
insert into t1 (a,b) values (1,3), (2,4); insert into t1 (a,b) values (1,3), (2,4);
Warnings: Warnings:
Warning 1647 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored
Warning 1647 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
...@@ -107,8 +107,8 @@ a b c ...@@ -107,8 +107,8 @@ a b c
create table t2 like t1; create table t2 like t1;
insert into t2 select * from t1; insert into t2 select * from t1;
Warnings: Warnings:
Warning 1647 The value specified for computed column 'b' in table 't2' ignored Warning 1906 The value specified for computed column 'b' in table 't2' ignored
Warning 1647 The value specified for computed column 'c' in table 't2' ignored Warning 1906 The value specified for computed column 'c' in table 't2' ignored
select * from t1; select * from t1;
a b c a b c
2 -2 -2 2 -2 -2
...@@ -123,8 +123,8 @@ a b c ...@@ -123,8 +123,8 @@ a b c
create table t2 like t1; create table t2 like t1;
insert into t2 (a,b) select a,b from t1; insert into t2 (a,b) select a,b from t1;
Warnings: Warnings:
Warning 1647 The value specified for computed column 'b' in table 't2' ignored Warning 1906 The value specified for computed column 'b' in table 't2' ignored
Warning 1647 The value specified for computed column 'b' in table 't2' ignored Warning 1906 The value specified for computed column 'b' in table 't2' ignored
select * from t2; select * from t2;
a b c a b c
2 -2 -2 2 -2 -2
...@@ -159,7 +159,7 @@ a b c ...@@ -159,7 +159,7 @@ a b c
2 -2 -2 2 -2 -2
update t1 set c=3 where a=2; update t1 set c=3 where a=2;
Warnings: Warnings:
Warning 1647 The value specified for computed column 'c' in table 't1' ignored Warning 1906 The value specified for computed column 'c' in table 't1' ignored
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
...@@ -189,7 +189,7 @@ a b c ...@@ -189,7 +189,7 @@ a b c
2 -2 -2 2 -2 -2
update t1 set c=3 where b=-2; update t1 set c=3 where b=-2;
Warnings: Warnings:
Warning 1647 The value specified for computed column 'c' in table 't1' ignored Warning 1906 The value specified for computed column 'c' in table 't1' ignored
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
......
...@@ -25,8 +25,8 @@ a b c ...@@ -25,8 +25,8 @@ a b c
# INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols # INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols
insert into t1 values (1,2,3); insert into t1 values (1,2,3);
Warnings: Warnings:
Warning 1647 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored
Warning 1647 The value specified for computed column 'c' in table 't1' ignored Warning 1906 The value specified for computed column 'c' in table 't1' ignored
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
...@@ -65,8 +65,8 @@ a b c ...@@ -65,8 +65,8 @@ a b c
# against vcols # against vcols
insert into t1 (a,b) values (1,3), (2,4); insert into t1 (a,b) values (1,3), (2,4);
Warnings: Warnings:
Warning 1647 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored
Warning 1647 The value specified for computed column 'b' in table 't1' ignored Warning 1906 The value specified for computed column 'b' in table 't1' ignored
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
...@@ -107,8 +107,8 @@ a b c ...@@ -107,8 +107,8 @@ a b c
create table t2 like t1; create table t2 like t1;
insert into t2 select * from t1; insert into t2 select * from t1;
Warnings: Warnings:
Warning 1647 The value specified for computed column 'b' in table 't2' ignored Warning 1906 The value specified for computed column 'b' in table 't2' ignored
Warning 1647 The value specified for computed column 'c' in table 't2' ignored Warning 1906 The value specified for computed column 'c' in table 't2' ignored
select * from t1; select * from t1;
a b c a b c
2 -2 -2 2 -2 -2
...@@ -123,8 +123,8 @@ a b c ...@@ -123,8 +123,8 @@ a b c
create table t2 like t1; create table t2 like t1;
insert into t2 (a,b) select a,b from t1; insert into t2 (a,b) select a,b from t1;
Warnings: Warnings:
Warning 1647 The value specified for computed column 'b' in table 't2' ignored Warning 1906 The value specified for computed column 'b' in table 't2' ignored
Warning 1647 The value specified for computed column 'b' in table 't2' ignored Warning 1906 The value specified for computed column 'b' in table 't2' ignored
select * from t2; select * from t2;
a b c a b c
2 -2 -2 2 -2 -2
...@@ -159,7 +159,7 @@ a b c ...@@ -159,7 +159,7 @@ a b c
2 -2 -2 2 -2 -2
update t1 set c=3 where a=2; update t1 set c=3 where a=2;
Warnings: Warnings:
Warning 1647 The value specified for computed column 'c' in table 't1' ignored Warning 1906 The value specified for computed column 'c' in table 't1' ignored
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
...@@ -189,7 +189,7 @@ a b c ...@@ -189,7 +189,7 @@ a b c
2 -2 -2 2 -2 -2
update t1 set c=3 where b=-2; update t1 set c=3 where b=-2;
Warnings: Warnings:
Warning 1647 The value specified for computed column 'c' in table 't1' ignored Warning 1906 The value specified for computed column 'c' in table 't1' ignored
select * from t1; select * from t1;
a b c a b c
1 -1 -1 1 -1 -1
......
...@@ -108,10 +108,10 @@ DROP TABLE t1,t2; ...@@ -108,10 +108,10 @@ DROP TABLE t1,t2;
CREATE TABLE t1 (p int, a double NOT NULL, v double AS (ROUND(a,p)) VIRTUAL); CREATE TABLE t1 (p int, a double NOT NULL, v double AS (ROUND(a,p)) VIRTUAL);
INSERT INTO t1 VALUES (0,1,0); INSERT INTO t1 VALUES (0,1,0);
Warnings: Warnings:
Warning 1647 The value specified for computed column 'v' in table 't1' ignored Warning 1906 The value specified for computed column 'v' in table 't1' ignored
INSERT INTO t1 VALUES (NULL,0,0); INSERT INTO t1 VALUES (NULL,0,0);
Warnings: Warnings:
Warning 1647 The value specified for computed column 'v' in table 't1' ignored Warning 1906 The value specified for computed column 'v' in table 't1' ignored
SELECT a, p, v, ROUND(a,p), ROUND(a,p+NULL) FROM t1; SELECT a, p, v, ROUND(a,p), ROUND(a,p+NULL) FROM t1;
a p v ROUND(a,p) ROUND(a,p+NULL) a p v ROUND(a,p) ROUND(a,p+NULL)
1 0 1 1 NULL 1 0 1 1 NULL
......
/* Copyright (C) 2000-2005 MySQL AB /* Copyright (C) 2000-2005 MySQL AB
Copyright (C) 2011 Monty Program Ab
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
static bool check_error_mesg(const char *file_name, const char **errmsg);
static bool read_texts(const char *file_name,const char ***point, static bool read_texts(const char *file_name,const char ***point,
uint error_messages); uint error_messages);
static void init_myfunc_errs(void); static void init_myfunc_errs(void);
...@@ -32,9 +34,12 @@ static void init_myfunc_errs(void); ...@@ -32,9 +34,12 @@ static void init_myfunc_errs(void);
Read messages from errorfile. Read messages from errorfile.
This function can be called multiple times to reload the messages. This function can be called multiple times to reload the messages.
If it fails to load the messages, it will fail softly by initializing
the errmesg pointer to an array of empty strings or by keeping the If it fails to load the messages:
old array if it exists. - If we already have error messages loaded, keep the old ones and
return FALSE(ok)
- Initializing the errmesg pointer to an array of empty strings
and return TRUE (error)
@retval @retval
FALSE OK FALSE OK
...@@ -44,25 +49,44 @@ static void init_myfunc_errs(void); ...@@ -44,25 +49,44 @@ static void init_myfunc_errs(void);
bool init_errmessage(void) bool init_errmessage(void)
{ {
const char **errmsgs, **ptr; const char **errmsgs, **ptr, **org_errmsgs;
bool error= FALSE;
DBUG_ENTER("init_errmessage"); DBUG_ENTER("init_errmessage");
/* /*
Get a pointer to the old error messages pointer array. Get a pointer to the old error messages pointer array.
read_texts() tries to free it. read_texts() tries to free it.
*/ */
errmsgs= my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST); org_errmsgs= my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST);
/* Read messages from file. */ /* Read messages from file. */
if (read_texts(ERRMSG_FILE, &errmsgs, ER_ERROR_LAST - ER_ERROR_FIRST + 1) && if (read_texts(ERRMSG_FILE, &errmsgs, ER_ERROR_LAST - ER_ERROR_FIRST + 1) ||
!errmsgs) check_error_mesg(ERRMSG_FILE, errmsgs))
{ {
if (!(errmsgs= (const char**) my_malloc((ER_ERROR_LAST-ER_ERROR_FIRST+1)* x_free(errmsgs);
sizeof(char*), MYF(0))))
DBUG_RETURN(TRUE); if (org_errmsgs)
for (ptr= errmsgs; ptr < errmsgs + ER_ERROR_LAST - ER_ERROR_FIRST; ptr++) {
*ptr= ""; /* Use old error messages */
errmsgs= org_errmsgs;
}
else
{
/*
No error messages. Create a temporary empty error message so
that we don't get a crash if some code wrongly tries to access
a non existing error message.
*/
if (!(errmsgs= (const char**) my_malloc((ER_ERROR_LAST-ER_ERROR_FIRST+1)*
sizeof(char*), MYF(0))))
DBUG_RETURN(TRUE);
for (ptr= errmsgs; ptr < errmsgs + ER_ERROR_LAST - ER_ERROR_FIRST; ptr++)
*ptr= "";
error= TRUE;
}
} }
else
x_free(org_errmsgs); // Free old language
/* Register messages for use with my_error(). */ /* Register messages for use with my_error(). */
if (my_error_register(errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST)) if (my_error_register(errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST))
...@@ -73,7 +97,29 @@ bool init_errmessage(void) ...@@ -73,7 +97,29 @@ bool init_errmessage(void)
errmesg= errmsgs; /* Init global variabel */ errmesg= errmsgs; /* Init global variabel */
init_myfunc_errs(); /* Init myfunc messages */ init_myfunc_errs(); /* Init myfunc messages */
DBUG_RETURN(FALSE); DBUG_RETURN(error);
}
/**
Check the error messages array contains all relevant error messages
*/
static bool check_error_mesg(const char *file_name, const char **errmsg)
{
/*
The last MySQL error message can't be an empty string; If it is,
it means that the error file doesn't contain all MySQL messages
and is probably from an older version of MySQL / MariaDB.
*/
if (errmsg[ER_LAST_MYSQL_ERROR_MESSAGE -1 - ER_ERROR_FIRST][0] == 0)
{
sql_print_error("Error message file '%s' is probably from and older "
"version of MariaDB / MYSQL as it doesn't contain all "
"error messages", file_name);
return 1;
}
return 0;
} }
...@@ -99,6 +145,8 @@ static bool read_texts(const char *file_name,const char ***point, ...@@ -99,6 +145,8 @@ static bool read_texts(const char *file_name,const char ***point,
const char *errmsg; const char *errmsg;
DBUG_ENTER("read_texts"); DBUG_ENTER("read_texts");
*point= 0;
LINT_INIT(buff); LINT_INIT(buff);
funktpos=0; funktpos=0;
if ((file=my_open(fn_format(name,file_name,language,"",4), if ((file=my_open(fn_format(name,file_name,language,"",4),
...@@ -108,6 +156,7 @@ static bool read_texts(const char *file_name,const char ***point, ...@@ -108,6 +156,7 @@ static bool read_texts(const char *file_name,const char ***point,
funktpos=1; funktpos=1;
if (my_read(file,(uchar*) head,32,MYF(MY_NABP))) goto err; if (my_read(file,(uchar*) head,32,MYF(MY_NABP))) goto err;
funktpos=2;
if (head[0] != (uchar) 254 || head[1] != (uchar) 254 || if (head[0] != (uchar) 254 || head[1] != (uchar) 254 ||
head[2] != 2 || head[3] != 1) head[2] != 2 || head[3] != 1)
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
...@@ -133,19 +182,16 @@ Please install the latest version of this file.",name); ...@@ -133,19 +182,16 @@ Please install the latest version of this file.",name);
if (count < error_messages) if (count < error_messages)
{ {
sql_print_error("\ sql_print_error("\
Error message file '%s' had only %d error messages,\n\ Error message file '%s' had only %d error messages, but it should contain at least %d error messages.\nCheck that the above file is the right version for this program!",
but it should contain at least %d error messages.\n\
Check that the above file is the right version for this program!",
name,count,error_messages); name,count,error_messages);
VOID(my_close(file,MYF(MY_WME))); VOID(my_close(file,MYF(MY_WME)));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
x_free((uchar*) *point); /* Free old language */
if (!(*point= (const char**) if (!(*point= (const char**)
my_malloc((size_t) (length+count*sizeof(char*)),MYF(0)))) my_malloc((size_t) (length+count*sizeof(char*)),MYF(0))))
{ {
funktpos=2; /* purecov: inspected */ funktpos=3; /* purecov: inspected */
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
} }
buff= (uchar*) (*point + count); buff= (uchar*) (*point + count);
...@@ -169,9 +215,11 @@ Check that the above file is the right version for this program!", ...@@ -169,9 +215,11 @@ Check that the above file is the right version for this program!",
err: err:
switch (funktpos) { switch (funktpos) {
case 2: case 3:
errmsg= "Not enough memory for messagefile '%s'"; errmsg= "Not enough memory for messagefile '%s'";
break; break;
case 2:
errmsg= "Incompatible header in messagefile '%s'. Probably from another version of MariaDB";
case 1: case 1:
errmsg= "Can't read from messagefile '%s'"; errmsg= "Can't read from messagefile '%s'";
break; break;
......
...@@ -6214,6 +6214,19 @@ ER_DEBUG_SYNC_HIT_LIMIT ...@@ -6214,6 +6214,19 @@ ER_DEBUG_SYNC_HIT_LIMIT
eng "debug sync point hit limit reached" eng "debug sync point hit limit reached"
ger "Debug Sync Point Hit Limit erreicht" ger "Debug Sync Point Hit Limit erreicht"
#
# MariaDB error messages section starts here
#
# The following is here to allow us to detect if there was missing
# error messages in the errmsg.sys file
ER_LAST_MYSQL_ERROR_MESSAGE
eng ""
# MariaDB error numbers starts from 1900
start-error-number 1900
ER_VCOL_BASED_ON_VCOL ER_VCOL_BASED_ON_VCOL
eng "A computed column cannot be based on a computed column" eng "A computed column cannot be based on a computed column"
......
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