Commit adf1e56e authored by Rich Prohaska's avatar Rich Prohaska

DB-504 test replace select triggers for bulk fetch

parent 401e0e5d
set default_storage_engine='tokudb';
drop table if exists s,t;
create table s (id bigint not null primary key, x bigint);
insert into s values (1,0),(2,0),(3,0),(4,0);
create table t like s;
begin;
replace into t select * from s;
rollback;
create trigger t_trigger before insert on t for each row replace into s values (1000000,0);
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after insert on t for each row replace into s values (1000000,0);
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger before insert on t for each row delete from s where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after insert on t for each row delete from s where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger before insert on t for each row update s set x=x+1 where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after insert on t for each row update s set x=x+1 where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
truncate table t;
insert into t values (1,1);
create trigger t_trigger before insert on t for each row replace into s values (1000000,0);
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after insert on t for each row replace into s values (1000000,0);
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger before insert on t for each row delete from s where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after insert on t for each row delete from s where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger before insert on t for each row update s set x=x+1 where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after insert on t for each row update s set x=x+1 where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
truncate table t;
insert into t values (1,1);
create trigger t_trigger before delete on t for each row replace into s values (1000000,0);
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after delete on t for each row replace into s values (1000000,0);
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger before delete on t for each row delete from s where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after delete on t for each row delete from s where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger before delete on t for each row update s set x=x+1 where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
create trigger t_trigger after delete on t for each row update s set x=x+1 where id=1000000;
begin;
replace into t select * from s;
ERROR HY000: Can't update table 's' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
rollback;
drop trigger t_trigger;
drop table s,t;
# verify that various insert and update triggers can not execute on the source table
# for a replace select statement
source include/have_tokudb.inc;
set default_storage_engine='tokudb';
disable_warnings;
drop table if exists s,t;
enable_warnings;
create table s (id bigint not null primary key, x bigint);
insert into s values (1,0),(2,0),(3,0),(4,0);
create table t like s;
begin;
replace into t select * from s;
rollback;
# verify that before insert triggers can not replace into the source table
create trigger t_trigger before insert on t for each row replace into s values (1000000,0);
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after insert triggers can not replace into the source table
create trigger t_trigger after insert on t for each row replace into s values (1000000,0);
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that before insert triggers can not delete from the source table
create trigger t_trigger before insert on t for each row delete from s where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after insert triggers can not delete from the source table
create trigger t_trigger after insert on t for each row delete from s where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that before insert triggers can not update the source table
create trigger t_trigger before insert on t for each row update s set x=x+1 where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after insert triggers can not update the source table
create trigger t_trigger after insert on t for each row update s set x=x+1 where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
truncate table t;
insert into t values (1,1);
# verify that before insert triggers can not replace into the source table
create trigger t_trigger before insert on t for each row replace into s values (1000000,0);
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after insert triggers can not replace into the source table
create trigger t_trigger after insert on t for each row replace into s values (1000000,0);
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that before insert triggers can not delete from the source table
create trigger t_trigger before insert on t for each row delete from s where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after insert triggers can not delete from the source table
create trigger t_trigger after insert on t for each row delete from s where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that before insert triggers can not update the source table
create trigger t_trigger before insert on t for each row update s set x=x+1 where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after insert triggers can not update the source table
create trigger t_trigger after insert on t for each row update s set x=x+1 where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
truncate table t;
insert into t values (1,1);
# verify that before delete triggers can not replace into the source table
create trigger t_trigger before delete on t for each row replace into s values (1000000,0);
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after delete triggers can not replace into the source table
create trigger t_trigger after delete on t for each row replace into s values (1000000,0);
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that before delete triggers can not delete from the source table
create trigger t_trigger before delete on t for each row delete from s where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after delete triggers can not delete from the source table
create trigger t_trigger after delete on t for each row delete from s where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that before delete triggers can not update the source table
create trigger t_trigger before delete on t for each row update s set x=x+1 where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
# verify that after delete triggers can not update the source table
create trigger t_trigger after delete on t for each row update s set x=x+1 where id=1000000;
begin;
error 1442;
replace into t select * from s;
rollback;
drop trigger t_trigger;
drop table s,t;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment