mirror of
https://github.com/MariaDB/server.git
synced 2025-06-30 08:28:15 +02:00

to SQL error plugin New plugin variable "with_db_and_thread_info" is added which prints the thread id and databse name to the logfile. the value is stored in variable "with_db_and_thread_info" log_sql_errors() is responsible for printing in the log. If detailed is enabled, print thread id and database name both, otherwise skip it.
58 lines
2.3 KiB
Text
58 lines
2.3 KiB
Text
drop procedure if exists test_error;
|
|
drop table if exists t1;
|
|
install plugin SQL_ERROR_LOG soname 'sql_errlog';
|
|
show variables like 'sql_error_log%';
|
|
Variable_name Value
|
|
sql_error_log_filename sql_errors.log
|
|
sql_error_log_rate 1
|
|
sql_error_log_rotate OFF
|
|
sql_error_log_rotations 9
|
|
sql_error_log_size_limit 1000000
|
|
sql_error_log_with_db_and_thread_info OFF
|
|
set global sql_error_log_rate=1;
|
|
select * from t_doesnt_exist;
|
|
ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
|
|
syntax_error_query;
|
|
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
|
|
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|
|
|
CALL test_error();
|
|
ERROR 40000: new message
|
|
drop procedure test_error;
|
|
SET SQL_MODE = STRICT_ALL_TABLES;
|
|
create table t1(id int);
|
|
insert into t1 values ('aa');
|
|
ERROR 22007: Incorrect integer value: 'aa' for column `test`.`t1`.`id` at row 1
|
|
SET SQL_MODE = '';
|
|
drop table t1;
|
|
SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists';
|
|
TABLE_NAME
|
|
CREATE procedure e1()
|
|
BEGIN
|
|
START TRANSACTION;
|
|
INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */;
|
|
COMMIT;
|
|
END|
|
|
CALL e1();
|
|
ERROR 42S02: Table 'test.non_exists' doesn't exist
|
|
DROP PROCEDURE e1;
|
|
uninstall plugin SQL_ERROR_LOG;
|
|
Warnings:
|
|
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
|
TIME HOSTNAME ERROR 1146: Table 'test.t_doesnt_exist' doesn't exist : select * from t_doesnt_exist
|
|
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
|
|
TIME HOSTNAME ERROR 1146: Table 'test.temptab' doesn't exist : SELECT `c` FROM `temptab`
|
|
TIME HOSTNAME ERROR 1000: new message : RESIGNAL SQLSTATE '40000' SET
|
|
MYSQL_ERRNO = 1000,
|
|
MESSAGE_TEXT = 'new message'
|
|
TIME HOSTNAME ERROR 1366: Incorrect integer value: 'aa' for column `test`.`t1`.`id` at row 1 : insert into t1 values ('aa')
|
|
TIME HOSTNAME ERROR 1146: Table 'test.non_exists' doesn't exist : INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */
|