| 1 |
drop procedure if exists test_error; |
| 2 |
drop table if exists t1; |
| 3 |
install plugin SQL_ERROR_LOG soname 'sql_errlog'; |
| 4 |
show variables like 'sql_error_log%'; |
| 5 |
Variable_name Value |
| 6 |
sql_error_log_filename sql_errors.log |
| 7 |
sql_error_log_rate 1 |
| 8 |
sql_error_log_rotate OFF |
| 9 |
sql_error_log_rotations 9 |
| 10 |
sql_error_log_size_limit 1000000 |
| 11 |
sql_error_log_warnings ON |
| 12 |
sql_error_log_with_db_and_thread_info OFF |
| 13 |
set global sql_error_log_rate=1; |
| 14 |
select * from t_doesnt_exist; |
| 15 |
ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist |
| 16 |
syntax_error_query; |
| 17 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'syntax_error_query' at line 1 |
| 18 |
CREATE PROCEDURE test_error() |
| 19 |
BEGIN |
| 20 |
DECLARE CONTINUE HANDLER |
| 21 |
FOR 1146 |
| 22 |
BEGIN |
| 23 |
RESIGNAL SQLSTATE '40000' SET |
| 24 |
MYSQL_ERRNO = 1000, |
| 25 |
MESSAGE_TEXT = 'new message'; |
| 26 |
END; |
| 27 |
SELECT `c` FROM `temptab`; |
| 28 |
END| |
| 29 |
CALL test_error(); |
| 30 |
ERROR 40000: new message |
| 31 |
drop procedure test_error; |
| 32 |
SET SQL_MODE = STRICT_ALL_TABLES; |
| 33 |
create table t1(id int); |
| 34 |
insert into t1 values ('aa'); |
| 35 |
ERROR 22007: Incorrect integer value: 'aa' for column `test`.`t1`.`id` at row 1 |
| 36 |
SET SQL_MODE = ''; |
| 37 |
drop table t1; |
| 38 |
SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists'; |
| 39 |
TABLE_NAME |
| 40 |
CREATE procedure e1() |
| 41 |
BEGIN |
| 42 |
START TRANSACTION; |
| 43 |
INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */; |
| 44 |
COMMIT; |
| 45 |
END| |
| 46 |
CALL e1(); |
| 47 |
ERROR 42S02: Table 'test.non_exists' doesn't exist |
| 48 |
DROP PROCEDURE e1; |
| 49 |
CREATE TABLE t1 (a char(4)); |
| 50 |
set sql_mode=""; |
| 51 |
insert into t1 value("12345"); |
| 52 |
Warnings: |
| 53 |
Warning 1265 Data truncated for column 'a' at row 1 |
| 54 |
set sql_mode=default; |
| 55 |
drop table t1; |
| 56 |
uninstall plugin SQL_ERROR_LOG; |
| 57 |
Warnings: |
| 58 |
Warning 1620 Plugin is busy and will be uninstalled on shutdown |
| 59 |
TIME HOSTNAME ERROR 1146: Table 'test.t_doesnt_exist' doesn't exist : select * from t_doesnt_exist |
| 60 |
TIME HOSTNAME ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'syntax_error_query' at line 1 : syntax_error_query |
| 61 |
TIME HOSTNAME ERROR 1146: Table 'test.temptab' doesn't exist : SELECT `c` FROM `temptab` |
| 62 |
TIME HOSTNAME ERROR 1000: new message : RESIGNAL SQLSTATE '40000' SET |
| 63 |
MYSQL_ERRNO = 1000, |
| 64 |
MESSAGE_TEXT = 'new message' |
| 65 |
TIME HOSTNAME ERROR 1366: Incorrect integer value: 'aa' for column `test`.`t1`.`id` at row 1 : insert into t1 values ('aa') |
| 66 |
TIME HOSTNAME ERROR 1146: Table 'test.non_exists' doesn't exist : INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */ |
| 67 |
TIME HOSTNAME WARNING 1265: Data truncated for column 'a' at row 1 : insert into t1 value("12345") |
| 68 |
TIME HOSTNAME WARNING 1620: Plugin is busy and will be uninstalled on shutdown : uninstall plugin SQL_ERROR_LOG |