| 1 |
set @old_global_general_log=@@global.general_log; |
| 2 |
set global general_log=OFF; |
| 3 |
create user testuser@localhost; |
| 4 |
grant select on *.* to testuser@localhost; |
| 5 |
install plugin audit_null soname 'adt_null'; |
| 6 |
select 1; |
| 7 |
1 |
| 8 |
1 |
| 9 |
select foobar; |
| 10 |
ERROR 42S22: Unknown column 'foobar' in 'SELECT' |
| 11 |
show status like 'audit_null%'; |
| 12 |
Variable_name Value |
| 13 |
Audit_null_called 9 |
| 14 |
Audit_null_general_error 1 |
| 15 |
Audit_null_general_log 3 |
| 16 |
Audit_null_general_result 2 |
| 17 |
Audit_null_general_warning 1 |
| 18 |
create procedure au1(x char(16)) select concat("test1", x); |
| 19 |
call au1("-12"); |
| 20 |
concat("test1", x) |
| 21 |
test1-12 |
| 22 |
show status like 'audit_null%'; |
| 23 |
Variable_name Value |
| 24 |
Audit_null_called 22 |
| 25 |
Audit_null_general_error 1 |
| 26 |
Audit_null_general_log 7 |
| 27 |
Audit_null_general_result 5 |
| 28 |
Audit_null_general_warning 1 |
| 29 |
create table t1 (a int); |
| 30 |
insert t1 values (1), (2); |
| 31 |
select * from t1; |
| 32 |
a |
| 33 |
1 |
| 34 |
2 |
| 35 |
rename table t1 to t2; |
| 36 |
alter table t2 add column b int; |
| 37 |
create definer=testuser@localhost view v1 as select t2.a+1, t2_copy.a+2 from t2, t2 as t2_copy; |
| 38 |
select * from v1; |
| 39 |
t2.a+1 t2_copy.a+2 |
| 40 |
2 3 |
| 41 |
3 3 |
| 42 |
2 4 |
| 43 |
3 4 |
| 44 |
drop view v1; |
| 45 |
create temporary table t2 (a date); |
| 46 |
insert t2 values ('2020-10-09'); |
| 47 |
select * from t2; |
| 48 |
a |
| 49 |
2020-10-09 |
| 50 |
alter table t2 add column b int; |
| 51 |
drop table t2; |
| 52 |
explain select distinct * from t2; |
| 53 |
id select_type table type possible_keys key key_len ref rows Extra |
| 54 |
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using temporary |
| 55 |
select distinct * from t2; |
| 56 |
a b |
| 57 |
1 NULL |
| 58 |
2 NULL |
| 59 |
drop table t2; |
| 60 |
uninstall plugin audit_null; |
| 61 |
Warnings: |
| 62 |
Warning 1620 Plugin is busy and will be uninstalled on shutdown |
| 63 |
drop procedure au1; |
| 64 |
drop user testuser@localhost; |
| 65 |
set global general_log=@old_global_general_log; |
| 66 |
root[root] @ localhost [] >> select 1 |
| 67 |
root[root] @ localhost [] >> select foobar |
| 68 |
root[root] @ localhost [] >> show status like 'audit_null%' |
| 69 |
root[root] @ localhost [] >> create procedure au1(x char(16)) select concat("test1", x) |
| 70 |
root[root] @ localhost [] mysql.proc : write |
| 71 |
root[root] @ localhost [] >> call au1("-12") |
| 72 |
root[root] @ localhost [] mysql.proc : read |
| 73 |
root[root] @ localhost [] >> select concat("test1", NAME_CONST('x',_utf8mb4'-12' COLLATE 'utf8mb4_uca1400_ai_ci')) |
| 74 |
root[root] @ localhost [] >> show status like 'audit_null%' |
| 75 |
root[root] @ localhost [] >> create table t1 (a int) |
| 76 |
root[root] @ localhost [] test.t1 : create |
| 77 |
root[root] @ localhost [] >> insert t1 values (1), (2) |
| 78 |
root[root] @ localhost [] test.t1 : write |
| 79 |
root[root] @ localhost [] mysql.table_stats : read |
| 80 |
root[root] @ localhost [] mysql.column_stats : read |
| 81 |
root[root] @ localhost [] mysql.index_stats : read |
| 82 |
root[root] @ localhost [] >> select * from t1 |
| 83 |
root[root] @ localhost [] test.t1 : read |
| 84 |
root[root] @ localhost [] >> rename table t1 to t2 |
| 85 |
root[root] @ localhost [] test.t1 : rename to test.t2 |
| 86 |
root[root] @ localhost [] mysql.table_stats : write |
| 87 |
root[root] @ localhost [] mysql.column_stats : write |
| 88 |
root[root] @ localhost [] mysql.index_stats : write |
| 89 |
root[root] @ localhost [] >> alter table t2 add column b int |
| 90 |
root[root] @ localhost [] test.t2 : alter |
| 91 |
root[root] @ localhost [] test.t2 : read |
| 92 |
root[root] @ localhost [] >> create definer=testuser@localhost view v1 as select t2.a+1, t2_copy.a+2 from t2, t2 as t2_copy |
| 93 |
root[root] @ localhost [] test.t2 : read |
| 94 |
root[root] @ localhost [] test.t2 : read |
| 95 |
root[root] @ localhost [] >> select * from v1 |
| 96 |
root[root] @ localhost [] test.t2 : read |
| 97 |
root[root] @ localhost [] test.t2 : read |
| 98 |
root[root] @ localhost [] mysql.table_stats : read |
| 99 |
root[root] @ localhost [] mysql.column_stats : read |
| 100 |
root[root] @ localhost [] mysql.index_stats : read |
| 101 |
root[root] @ localhost [] >> drop view v1 |
| 102 |
root[root] @ localhost [] >> create temporary table t2 (a date) |
| 103 |
root[root] @ localhost [] >> insert t2 values ('2020-10-09') |
| 104 |
root[root] @ localhost [] >> select * from t2 |
| 105 |
root[root] @ localhost [] >> alter table t2 add column b int |
| 106 |
root[root] @ localhost [] >> drop table t2 |
| 107 |
root[root] @ localhost [] >> explain select distinct * from t2 |
| 108 |
root[root] @ localhost [] test.t2 : read |
| 109 |
root[root] @ localhost [] >> select distinct * from t2 |
| 110 |
root[root] @ localhost [] test.t2 : read |
| 111 |
root[root] @ localhost [] >> drop table t2 |
| 112 |
root[root] @ localhost [] mysql.table_stats : write |
| 113 |
root[root] @ localhost [] mysql.column_stats : write |
| 114 |
root[root] @ localhost [] mysql.index_stats : write |
| 115 |
root[root] @ localhost [] test.t2 : drop |
| 116 |
root[root] @ localhost [] >> uninstall plugin audit_null |
| 117 |
root[root] @ localhost [] mysql.plugin : write |