MDEV-4564 ALTER on a temporary table generates an audit event
This commit is contained in:
parent
3bc814beda
commit
6625fad8ca
@ -44,6 +44,7 @@ insert t2 values ('2020-10-09');
|
||||
select * from t2;
|
||||
a
|
||||
2020-10-09
|
||||
alter table t2 add column b int;
|
||||
drop table t2;
|
||||
explain select distinct * from t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -77,8 +78,8 @@ root[root] @ localhost [] test.t1 : read
|
||||
root[root] @ localhost [] >> rename table t1 to t2
|
||||
root[root] @ localhost [] test.t1 : rename to test.t2
|
||||
root[root] @ localhost [] >> alter table t2 add column b int
|
||||
root[root] @ localhost [] test.t2 : alter
|
||||
root[root] @ localhost [] test.t2 : read
|
||||
root[root] @ localhost [] test.t2 : alter
|
||||
root[root] @ localhost [] >> create definer=testuser@localhost view v1 as select t2.a+1, t2_copy.a+2 from t2, t2 as t2_copy
|
||||
root[root] @ localhost [] test.t2 : read
|
||||
root[root] @ localhost [] test.t2 : read
|
||||
@ -89,6 +90,7 @@ root[root] @ localhost [] >> drop view v1
|
||||
root[root] @ localhost [] >> create temporary table t2 (a date)
|
||||
root[root] @ localhost [] >> insert t2 values ('2020-10-09')
|
||||
root[root] @ localhost [] >> select * from t2
|
||||
root[root] @ localhost [] >> alter table t2 add column b int
|
||||
root[root] @ localhost [] >> drop table t2
|
||||
root[root] @ localhost [] >> explain select distinct * from t2
|
||||
root[root] @ localhost [] test.t2 : read
|
||||
|
@ -38,6 +38,7 @@ drop view v1;
|
||||
create temporary table t2 (a date);
|
||||
insert t2 values ('2020-10-09');
|
||||
select * from t2;
|
||||
alter table t2 add column b int; # MDEV-4565 ALTER on a temporary table generates an audit event
|
||||
drop table t2;
|
||||
|
||||
# internal temp table generates no audit events
|
||||
|
@ -6064,13 +6064,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
|
||||
mysql_ha_rm_tables(thd, table_list);
|
||||
|
||||
mysql_audit_alter_table(thd, table_list);
|
||||
|
||||
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
|
||||
if (alter_info->tablespace_op != NO_TABLESPACE_OP)
|
||||
{
|
||||
mysql_audit_alter_table(thd, table_list);
|
||||
|
||||
/* Conditionally writes to binlog. */
|
||||
DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
|
||||
alter_info->tablespace_op));
|
||||
bool ret= mysql_discard_or_import_tablespace(thd,table_list,
|
||||
alter_info->tablespace_op);
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
Code below can handle only base tables so ensure that we won't open a view.
|
||||
@ -6262,6 +6265,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
my_error(ER_ILLEGAL_HA, MYF(0), table_name);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (table->s->tmp_table == NO_TMP_TABLE)
|
||||
mysql_audit_alter_table(thd, table_list);
|
||||
|
||||
thd_proc_info(thd, "setup");
|
||||
if (!(alter_info->flags & ~(ALTER_RENAME | ALTER_KEYS_ONOFF)) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user