# BUG#45574: 
# SP: CREATE DATABASE|TABLE IF NOT EXISTS not binlogged if routine exists.
#
#   There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
#   CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
#   binlogged even if either the DB, TABLE or EVENT does not exist. In
#   contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
#   exists.  
#
#   This problem caused some of the tests to fail randomly on PB or PB2.
#
#   Test is implemented as follows:
#
#       i) test each "CREATE TEMPORARY TABLE IF EXISTS" (DDL), found in MySQL
#       5.1 manual, on existent objects; 
#       ii) show binlog events; 
#
#  Note: 
#  rpl_create_if_not_exists.test tests other cases.
#
#  References:
#  http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
#

source include/master-slave.inc;
#CREATE TEMPORARY TABLE statements are not binlogged in row mode,
#So it must be test by itself.
source include/have_binlog_format_mixed_or_statement.inc;
disable_warnings;

DROP DATABASE IF EXISTS mysqltest;

CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
source include/show_binlog_events.inc;

--source include/rpl_end.inc
