File: sql_error_log.test

package info (click to toggle)
mariadb-10.0 10.0.32-0%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 476,064 kB
  • sloc: cpp: 1,400,131; ansic: 832,140; perl: 54,391; sh: 41,304; pascal: 32,365; yacc: 14,921; xml: 5,257; sql: 4,667; cs: 4,647; makefile: 4,555; ruby: 4,465; python: 2,292; lex: 1,427; java: 941; asm: 295; awk: 54; php: 22; sed: 16
file content (75 lines) | stat: -rw-r--r-- 1,546 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

--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';

#
# MDEV-6421 SQL_ERROR_LOG doesn't log comments in Events
#   actually testing SP call is enough for that.

DELIMITER |;

CREATE procedure e1()
BEGIN
  START TRANSACTION;
  INSERT INTO test.non_exists VALUES (0,0,0) /* e1  */;
  COMMIT;
END|

DELIMITER ;|
--error ER_NO_SUCH_TABLE
CALL e1();
DROP PROCEDURE e1;

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;