1drop function if exists bug23333;
2drop table if exists t1,t2;
3CREATE TABLE t1 (a int  NOT NULL auto_increment primary key) ENGINE=MyISAM;
4CREATE TABLE t2 (a int  NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
5insert into t2 values (1,1);
6create function bug23333()
7RETURNS int(11)
8DETERMINISTIC
9begin
10insert into t1 values (null);
11select count(*) from t1 into @a;
12return @a;
13end|
14reset master;
15insert into t2 values (bug23333(),1);
16ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
17include/show_binlog_events.inc
18Log_name	Pos	Event_type	Server_id	End_log_pos	Info
19master-bin.000001	#	Query	#	#	BEGIN
20master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
21master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
22master-bin.000001	#	Query	#	#	COMMIT
23select count(*),@a from t1 /* must be 1,1 */;
24count(*)	@a
251	1
26drop table t1,t2;
27drop function if exists bug23333;
28