Commit 3761b256 authored by jimw@mysql.com's avatar jimw@mysql.com

Bug #18495: mysqltest does not use the correct error number

  When looking up the error number for named errors in mysqltest .test
  files, we inadvertantly would match ER_WRONG_VALUE against
  ER_WRONG_VALUE_COUNT because we were using the length of the shorter
  string in strncmp(). Now we double-check the length of matches to
  make sure it was a complete match.
parent 865f533c
...@@ -1956,7 +1956,13 @@ static uint get_errcodes(match_err *to,struct st_query *q) ...@@ -1956,7 +1956,13 @@ static uint get_errcodes(match_err *to,struct st_query *q)
; ;
for (; e->name; e++) for (; e->name; e++)
{ {
if (!strncmp(start, e->name, (int) (p - start))) /*
If we get a match, we need to check the length of the name we
matched against in case it was longer than what we are checking
(as in ER_WRONG_VALUE vs. ER_WRONG_VALUE_COUNT).
*/
if (!strncmp(start, e->name, (int) (p - start)) &&
strlen(e->name) == (p - start))
{ {
to[count].code.errnum= (uint) e->code; to[count].code.errnum= (uint) e->code;
to[count].type= ERR_ERRNO; to[count].type= ERR_ERRNO;
......
...@@ -320,9 +320,9 @@ drop event one_event; ...@@ -320,9 +320,9 @@ drop event one_event;
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
drop event e_26; drop event e_26;
--error 1504 --error ER_WRONG_VALUE
create event e_26 on schedule at NULL disabled do set @a = 5; create event e_26 on schedule at NULL disabled do set @a = 5;
--error 1504 --error ER_WRONG_VALUE
create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5; create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
set names utf8; set names utf8;
......
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