mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
value should be checked after 'before' trigger work (BUG#5992)
This commit is contained in:
@ -1547,3 +1547,14 @@ s1
|
|||||||
3
|
3
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (s1 tinyint);
|
||||||
|
create trigger t1_bi before insert on t1 for each row set new.s1 = 500;
|
||||||
|
create view v1 as select * from t1 where s1 <> 127 with check option;
|
||||||
|
insert into v1 values (0);
|
||||||
|
ERROR HY000: CHECK OPTION failed 'test.v1'
|
||||||
|
select * from v1;
|
||||||
|
s1
|
||||||
|
select * from t1;
|
||||||
|
s1
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
@ -1497,3 +1497,17 @@ select * from t1;
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# changing value by trigger and CHECK OPTION
|
||||||
|
#
|
||||||
|
create table t1 (s1 tinyint);
|
||||||
|
create trigger t1_bi before insert on t1 for each row set new.s1 = 500;
|
||||||
|
create view v1 as select * from t1 where s1 <> 127 with check option;
|
||||||
|
-- error 1369
|
||||||
|
insert into v1 values (0);
|
||||||
|
select * from v1;
|
||||||
|
select * from t1;
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,6 +319,15 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
FIXME: Actually we should do this before
|
||||||
|
check_that_all_fields_are_given_values Or even go into write_record ?
|
||||||
|
*/
|
||||||
|
if (table->triggers)
|
||||||
|
table->triggers->process_triggers(thd, TRG_EVENT_INSERT,
|
||||||
|
TRG_ACTION_BEFORE);
|
||||||
|
|
||||||
if ((res= table_list->view_check_option(thd,
|
if ((res= table_list->view_check_option(thd,
|
||||||
(values_list.elements == 1 ?
|
(values_list.elements == 1 ?
|
||||||
0 :
|
0 :
|
||||||
@ -330,15 +339,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
error= 1;
|
error= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
FIXME: Actually we should do this before
|
|
||||||
check_that_all_fields_are_given_values Or even go into write_record ?
|
|
||||||
*/
|
|
||||||
if (table->triggers)
|
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_INSERT,
|
|
||||||
TRG_ACTION_BEFORE);
|
|
||||||
|
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (lock_type == TL_WRITE_DELAYED)
|
if (lock_type == TL_WRITE_DELAYED)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user