Debian Codegraph @

mysql-test/suite/plugins/t/sql_error_log.test

raw
1 --source include/not_embedded.inc
2
3 if (!$SQL_ERRLOG_SO) {
4 skip No SQL_ERROR_LOG plugin;
5 }
6
7 --disable_warnings
8 drop procedure if exists test_error;
9 drop table if exists t1;
10 --enable_warnings
11
12 install plugin SQL_ERROR_LOG soname 'sql_errlog';
13
14 show variables like 'sql_error_log%';
15 set global sql_error_log_rate=1;
16 --error ER_NO_SUCH_TABLE
17 select * from t_doesnt_exist;
18 --error 1064
19 syntax_error_query;
20
21 delimiter |;
22
23 CREATE PROCEDURE test_error()
24 BEGIN
25 DECLARE CONTINUE HANDLER
26 FOR 1146
27 BEGIN
28 RESIGNAL SQLSTATE '40000' SET
29 MYSQL_ERRNO = 1000,
30 MESSAGE_TEXT = 'new message';
31 END;
32 SELECT `c` FROM `temptab`;
33 END|
34
35 delimiter ;|
36
37 --error 1000
38 CALL test_error();
39 drop procedure test_error;
40
41 SET SQL_MODE = STRICT_ALL_TABLES;
42 create table t1(id int);
43 --error 1366
44 insert into t1 values ('aa');
45 SET SQL_MODE = '';
46 drop table t1;
47
48 SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'not_exists' AND TABLE_NAME = 'not_exists';
49
50 #
51 # MDEV-6421 SQL_ERROR_LOG doesn't log comments in Events
52 # actually testing SP call is enough for that.
53
54 DELIMITER |;
55
56 CREATE procedure e1()
57 BEGIN
58 START TRANSACTION;
59 INSERT INTO test.non_exists VALUES (0,0,0) /* e1 */;
60 COMMIT;
61 END|
62
63 DELIMITER ;|
64 --error ER_NO_SUCH_TABLE
65 CALL e1();
66 DROP PROCEDURE e1;
67
68 CREATE TABLE t1 (a char(4));
69 set sql_mode="";
70 insert into t1 value("12345");
71 set sql_mode=default;
72 drop table t1;
73
74 uninstall plugin SQL_ERROR_LOG;
75
76 let $MYSQLD_DATADIR= `SELECT @@datadir`;
77 # replace the timestamp and the hostname with constant values
78 --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] [^EW]*/TIME HOSTNAME /
79 cat_file $MYSQLD_DATADIR/sql_errors.log;
80 remove_file $MYSQLD_DATADIR/sql_errors.log;