1#
2# Test mixing transactional and non transactional tables
3#
4
5--source include/master-slave.inc
6--source include/have_innodb.inc
7--source include/have_binlog_format_row.inc
8
9#
10# Test updating conditionally a non transactinal table in a function
11# This verifies that we don't write only a table map for a non transactional,
12# without any row events
13# The original bug caused a crash on the slave when doing a sync_slave
14#
15
16create or replace table t1(id int)engine=innodb;
17create or replace table t3(id int)engine=myisam;
18
19delimiter //;
20create or replace function t99 (a int)
21returns int(10)
22MODIFIES SQL DATA
23begin
24  if (a > 100)
25  then
26    insert into t3 values (a);
27  end if;
28  return a;
29end//
30delimiter ;//
31begin;
32insert into t1 values(t99(1));
33insert into t1 values(t99(101));
34commit;
35select * from t1;
36select * from t3;
37insert into t1 values(t99(1));
38
39drop function t99;
40drop table t1,t3;
41
42sync_slave_with_master;
43connection master;
44
45#
46# MDEV-8203
47# Assertion `!current_stmt_is_commit || !rgi->tables_to_lock' failed in
48# Query_log_event::do_apply_event(rpl_group_info*, const char*, uint32)
49#
50
51CREATE TABLE t1 (i INT) ENGINE=InnoDB;
52CREATE TABLE t2 (j INT) ENGINE=MyISAM;
53
54--delimiter ||
55CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW
56BEGIN
57  SET @a = unknown_column_just_to_raise_an_error;
58  INSERT INTO t2 VALUES (NULL) ;
59END||
60--delimiter ;
61
62--error ER_BAD_FIELD_ERROR
63INSERT INTO t1 VALUES (1);
64--sync_slave_with_master
65
66connection master;
67
68drop trigger tr;
69drop table t1,t2;
70
71# End of 4.1 tests
72--source include/rpl_end.inc
73