mariadb/mysql-test/suite/plugins/t/sql_error_log.test
Alexey Botchkov 142c20eda9 MDEV-4856 SQL_ERROR_LOG shows 1146 errors which didnt appear in mysql client.
The fill_schema_table() function used to call get_table_share() for a table name in WHERE
    then clear the error list. That way plugins receive the superfluous error notification if it
    happens in it. Also the problem was that error handler didn't prevent the suppressed
    error message from logging anyway as the logging happens in THD::raise_condition
    before the handler call.
    Trigger_error_handler is remade into Warnings_only_error_handler, so it stores the error
    message in all cases in the thd->stmt_da.
    Then later the stored error is raised.
2014-04-15 20:41:08 +05:00

57 lines
1.2 KiB
Text

--source include/not_embedded.inc
if (!$SQL_ERRLOG_SO) {
skip No SQL_ERROR_LOG plugin;
}
--disable_warnings
drop procedure if exists test_error;
drop table if exists t1;
--enable_warnings
install plugin SQL_ERROR_LOG soname 'sql_errlog';
show variables like 'sql_error_log%';
set global sql_error_log_rate=1;
--error ER_NO_SUCH_TABLE
select * from t_doesnt_exist;
--error 1064
syntax_error_query;
delimiter |;
CREATE PROCEDURE test_error()
BEGIN
DECLARE CONTINUE HANDLER
FOR 1146
BEGIN
RESIGNAL SQLSTATE '40000' SET
MYSQL_ERRNO = 1000,
MESSAGE_TEXT = 'new message';
END;
SELECT `c` FROM `temptab`;
END|
delimiter ;|
--error 1000
CALL test_error();
drop procedure test_error;
SET SQL_MODE = STRICT_ALL_TABLES;
create table t1(id int);
--error 1366
insert into t1 values ('aa');
SET SQL_MODE = '';
drop table t1;
SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists';
uninstall plugin SQL_ERROR_LOG;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
# replace the timestamp and the hostname with constant values
--replace_regex /[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [^E]*/TIME HOSTNAME /
cat_file $MYSQLD_DATADIR/sql_errors.log;