1# BUG#45574:
2# SP: CREATE DATABASE|TABLE IF NOT EXISTS not binlogged if routine exists.
3#
4#   There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
5#   CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
6#   binlogged even if either the DB, TABLE or EVENT does not exist. In
7#   contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
8#   exists.
9#
10#   This problem caused some of the tests to fail randomly on PB or PB2.
11#
12#   Test is implemented as follows:
13#
14#       i) test each "CREATE TEMPORARY TABLE IF EXISTS" (DDL), found in MySQL
15#       5.1 manual, on existent objects;
16#       ii) show binlog events;
17#
18#  Note:
19#  rpl_create_if_not_exists.test tests other cases.
20#
21#  References:
22#  http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
23#
24
25#CREATE TEMPORARY TABLE statements are not binlogged in row mode,
26#So it must be test by itself.
27source include/have_binlog_format_mixed_or_statement.inc;
28source include/master-slave.inc;
29disable_warnings;
30
31DROP DATABASE IF EXISTS mysqltest;
32
33CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
34CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int);
35CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
36CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp;
37CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
38CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp;
39source include/show_binlog_events.inc;
40
41DROP TEMPORARY TABLE tmp;
42DROP TEMPORARY TABLE tmp1;
43DROP TEMPORARY TABLE tmp2;
44
45--source include/rpl_end.inc
46