mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
MDEV-9535 Trigger doing "SET NEW.auctionStart = NOW();" on a timestamp kills MariaDB server
when doing set_field_to_new_field (from switch_to_nullable_trigger_fields()) make sure that the field we're about to change actually belongs to the right table (otherwise we cannot dereference new_field[] array as the wrong table might have more fields than new_field[] has elements)
This commit is contained in:
parent
0fcd0ee34e
commit
57905d18d6
3 changed files with 19 additions and 1 deletions
|
@ -334,3 +334,10 @@ a b
|
|||
1 3
|
||||
2 4
|
||||
drop table t1, t2;
|
||||
create table t1 (a int not null);
|
||||
create table t2 (f1 int unsigned not null, f2 int);
|
||||
insert into t2 values (1, null);
|
||||
create trigger tr1 before update on t1 for each row do 1;
|
||||
create trigger tr2 after update on t2 for each row update t1 set a=new.f2;
|
||||
update t2 set f2=1 where f1=1;
|
||||
drop table t1, t2;
|
||||
|
|
|
@ -349,3 +349,14 @@ create table t2 select a as c, b as d from t1;
|
|||
update t1 set a=(select count(c) from t2 where c+1=a+1 group by a);
|
||||
select * from t1;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# MDEV-9535 Trigger doing "SET NEW.auctionStart = NOW();" on a timestamp kills MariaDB server.
|
||||
#
|
||||
create table t1 (a int not null);
|
||||
create table t2 (f1 int unsigned not null, f2 int);
|
||||
insert into t2 values (1, null);
|
||||
create trigger tr1 before update on t1 for each row do 1;
|
||||
create trigger tr2 after update on t2 for each row update t1 set a=new.f2;
|
||||
update t2 set f2=1 where f1=1;
|
||||
drop table t1, t2;
|
||||
|
|
|
@ -2381,7 +2381,7 @@ bool Item_field::update_table_bitmaps_processor(uchar *arg)
|
|||
|
||||
static inline void set_field_to_new_field(Field **field, Field **new_field)
|
||||
{
|
||||
if (*field)
|
||||
if (*field && (*field)->table == new_field[0]->table)
|
||||
{
|
||||
Field *newf= new_field[(*field)->field_index];
|
||||
if ((*field)->ptr == newf->ptr)
|
||||
|
|
Loading…
Reference in a new issue