Commit eb18f93a authored by unknown's avatar unknown
Browse files

Show all generated warnings in SHOW ERROR

Previously we only stored the first given error (the error sent to the client)


include/mysys_err.h:
  Moved ER_FILENOTFOUND last to avoid getting 'error 0'
mysql-test/r/backup.result:
  More warnings from in case of errors
mysql-test/r/innodb.result:
  More warnings from in case of errors
mysql-test/r/key_cache.result:
  More warnings from in case of errors
mysql-test/r/myisam.result:
  More warnings from in case of errors
mysql-test/r/preload.result:
  More warnings from in case of errors
mysql-test/r/repair.result:
  More warnings from in case of errors
mysql-test/r/rpl_failed_optimize.result:
  More warnings from in case of errors
mysql-test/r/subselect.result:
  More warnings from in case of errors
mysql-test/t/backup.test:
  Portability fix
mysql-test/t/innodb.test:
  Avoid some warnings
mysql-test/t/myisam.test:
  Portability fix
mysql-test/t/rpl_rotate_logs.test:
  Portablitiy fix
mysys/errors.c:
  Move ER_FILENOTFOUND last to avoid error 0
sql/mysql_priv.h:
  Indentation change
sql/mysqld.cc:
  Save all given errors for SHOW ERRORS
sql/protocol.cc:
  Store new errors for SHOW ERROR
  (Ignore those that are already reported with my_error())
sql/sql_class.cc:
  More errors with SHOW ERROR
sql/sql_class.h:
  More errors with SHOW ERROR
sql/sql_error.cc:
  More errors with SHOW ERROR
sql/sql_parse.cc:
  Temporary fix: Don't give error for the to-be-removed 'pre-open tables code'
sql/sql_show.cc:
  More debugging
  Don't register errors while populating schema tables.
  (If we do, we get a LOT of warnings from information_schema.test)
sql/sql_table.cc:
  Don't register errors from handler in drop table (as we already do it the upper level DROP TABLE code)
  Don't register errors for 'restore_table' as in most cases the table doesn't exists
sql/sql_union.cc:
  Use file->write_row() instead of 'write_record'.
  This gives us easer to handle error messages and is faster than the old version
parent a2a1449c
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -26,10 +26,14 @@ extern "C" {
extern const char * NEAR globerrs[];	/* my_error_messages is here */

/* Error message numbers in global map */
/* Do not add error numbers before EE_ERROR_FIRST. */
/* If necessary to add lower numbers, change EE_ERROR_FIRST accordingly. */
#define EE_ERROR_FIRST          0 /*Copy first error nr.*/
#define EE_FILENOTFOUND		0
/*
  Do not add error numbers before EE_ERROR_FIRST.
  If necessary to add lower numbers, change EE_ERROR_FIRST accordingly.

  We start with error 1 to not confuse peoples with 'error 0'
*/

#define EE_ERROR_FIRST          1 /*Copy first error nr.*/
#define EE_CANTCREATEFILE	1
#define EE_READ			2
#define EE_WRITE		3
@@ -57,7 +61,8 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_REALPATH		26
#define EE_SYNC			27
#define EE_UNKNOWN_COLLATION	28
#define EE_ERROR_LAST           28 /*Copy last error nr.*/
#define EE_FILENOTFOUND		29
#define EE_ERROR_LAST           29 /*Copy last error nr.*/
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */

  /* exit codes for all MySQL programs */
+6 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@ backup table t4 to '../bogus';
Table	Op	Msg_type	Msg_text
test.t4	backup	error	Failed copying .frm file (errno: X)
test.t4	backup	status	Operation failed
Warnings:
Error	1	Can't create/write to file 'MYSQL_TEST_DIR/var/bogus/t4.frm' (Errcode: X)
backup table t4 to '../tmp';
Table	Op	Msg_type	Msg_text
test.t4	backup	status	OK
@@ -12,6 +14,8 @@ backup table t4 to '../tmp';
Table	Op	Msg_type	Msg_text
test.t4	backup	error	Failed copying .frm file (errno: X)
test.t4	backup	status	Operation failed
Warnings:
Error	1	Can't create/write to file 'MYSQL_TEST_DIR/var/tmp/t4.frm' (Errcode: X)
drop table t4;
restore table t4 from '../tmp';
Table	Op	Msg_type	Msg_text
@@ -28,6 +32,8 @@ drop table t1;
restore table t1 from '../bogus';
Table	Op	Msg_type	Msg_text
t1	restore	error	Failed copying .frm file
Warnings:
Error	29	File 'MYSQL_TEST_DIR/var/bogus/t1.frm' not found (Errcode: X)
restore table t1 from '../tmp';
Table	Op	Msg_type	Msg_text
test.t1	restore	status	OK
+4 −4
Original line number Diff line number Diff line
@@ -1449,18 +1449,18 @@ test.t1 2948697075
test.t2	NULL
test.t3	NULL
test.t4	NULL
checksum table t1, t2, t3, t4;
Warnings:
Error	1146	Table 'test.t4' doesn't exist
checksum table t1, t2, t3;
Table	Checksum
test.t1	2948697075
test.t2	968604391
test.t3	968604391
test.t4	NULL
checksum table t1, t2, t3, t4 extended;
checksum table t1, t2, t3 extended;
Table	Checksum
test.t1	3092701434
test.t2	968604391
test.t3	968604391
test.t4	NULL
drop table t1,t2,t3;
create table t1 (id int,  name char(10) not null,  name2 char(10) not null) engine=innodb;
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+2 −0
Original line number Diff line number Diff line
@@ -193,6 +193,8 @@ cache index t1 key (unknown_key) in keycache1;
Table	Op	Msg_type	Msg_text
test.t1	assign_to_keycache	error	Key column 'unknown_key' doesn't exist in table
test.t1	assign_to_keycache	status	Operation failed
Warnings:
Error	1072	Key column 'unknown_key' doesn't exist in table
select @@keycache2.key_buffer_size;
@@keycache2.key_buffer_size
4194304
+6 −0
Original line number Diff line number Diff line
@@ -516,16 +516,22 @@ Table Checksum
test.t1	2948697075
test.t2	NULL
test.t3	NULL
Warnings:
Error	1146	Table 'test.t3' doesn't exist
checksum table t1, t2, t3;
Table	Checksum
test.t1	2948697075
test.t2	3092701434
test.t3	NULL
Warnings:
Error	1146	Table 'test.t3' doesn't exist
checksum table t1, t2, t3 extended;
Table	Checksum
test.t1	3092701434
test.t2	3092701434
test.t3	NULL
Warnings:
Error	1146	Table 'test.t3' doesn't exist
drop table t1,t2;
create table t1 (a int, key (a));
show keys from t1;
Loading