Commit c6a72326 authored by unknown's avatar unknown

Improved error message for failing with wrong error


client/mysqltest.c:
  Display the error message along with error number when query fails with wrong expected error.
mysql-test/r/mysqltest.result:
  Update test results
parent 79476010
......@@ -3549,11 +3549,12 @@ static void handle_error(const char *query, struct st_query *q,
if (i)
{
if (q->expected_errno[0].type == ERR_ERRNO)
die("query '%s' failed with wrong errno %d instead of %d...",
q->query, err_errno, q->expected_errno[0].code.errnum);
die("query '%s' failed with wrong errno %d: '%s', instead of %d...",
q->query, err_errno, err_error, q->expected_errno[0].code.errnum);
else
die("query '%s' failed with wrong sqlstate %s instead of %s...",
q->query, err_sqlstate, q->expected_errno[0].code.sqlstate);
die("query '%s' failed with wrong sqlstate %s: '%s', instead of %s...",
q->query, err_sqlstate, err_error,
q->expected_errno[0].code.sqlstate);
}
DBUG_VOID_RETURN;
......
......@@ -16,7 +16,7 @@ otto
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22 instead of 00000...
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22: 'Unknown column 'friedrich' in 'field list'', instead of 00000...
select otto from (select 1 as otto) as t1;
otto
1
......@@ -133,7 +133,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
select 1146 as "after_!errno_masked_error" ;
after_!errno_masked_error
1146
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000...
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
select 1064 as "after_--enable_abort_on_error" ;
......@@ -141,7 +141,7 @@ after_--enable_abort_on_error
1064
select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1064...
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1064...
hello
hello
;;;;;;;;
......@@ -374,7 +374,7 @@ mysqltest: At line 1: Missing connection user
mysqltest: At line 1: Missing connection user
mysqltest: At line 1: Missing connection password
mysqltest: At line 1: Missing connection db
mysqltest: At line 1: Could not open connection 'con2': Unknown database 'illegal_db'
mysqltest: At line 1: Could not open connection 'con2': 1049 Unknown database 'illegal_db'
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP
OK
......
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