### Bug #22865 	CREATE ... SELECT is logged too late

# to repoduce the bug it is necessary:
# 2 connection, one of which runs in autocommit=0
# There are tree failures to be found by twisting two parementers: 
#  - engine
#  - binlog_format
#  engine=myisam && binlog_format=statements exceptionally behaves correctly


drop table if exists t;
reset master;

set @@global.binlog_format=row;

connect (con1,localhost,root,,);
connect (con2,localhost,root,,);

connection con1;
set autocommit=0;
create table t (a int)  select (1) as b;

connection con2;
insert into t values(1,1);

connection con1;
commit;

show binlog events;   # will list insert,create - in such wrong order.                                
