--let $error_code= ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION
--let $error_message= Statement violates GTID consistency: CREATE TEMPORARY
--let $sync_point= before_execute_sql_command
--let $gtid_violation= 1

# When CREATE TEMPORARY or DROP TEMPORARY occurs in the middle of a
# transaction, it is a GTID-violation because these statements do not
# generate an implicit commit, but cannot be rolled back.  This is
# regardless of the storage engine.

# When the created table is myisam, it is considered a
# non-transactional statement, and therefore logged before the
# transaction ends, and thus anonymous ownership is released and the
# counters decreased.  Except when binlog_format=row: in that case
# CREATE TEMPORARY is not logged at all.  Therefore, the transaction
# context is left open, so it keeps anonymous ownership, and does not
# modify counter values.

--echo ---- CREATE TEMPORARY in trx (InnoDB, BEGIN) ----
--let $statement_ends_transaction= 0
--let $pre_statement= BEGIN
--let $statement= CREATE TEMPORARY TABLE t1 (a INT) ENGINE = InnoDB
--source extra/binlog_tests/enforce_gtid_consistency_statement.inc
DROP TEMPORARY TABLE IF EXISTS t1;

--echo ---- CREATE TEMPORARY in trx (MyISAM, BEGIN) ----
--let $statement_ends_transaction= 1
--let $statement_ends_transaction_row= 0
--let $pre_statement= BEGIN
--let $statement= CREATE TEMPORARY TABLE t1 (a INT) ENGINE = MyISAM
--source extra/binlog_tests/enforce_gtid_consistency_statement.inc
DROP TEMPORARY TABLE IF EXISTS t1;

--echo ---- CREATE TEMPORARY in trx (InnoDB, AUTOCOMMIT=0) ----
--let $statement_ends_transaction= 0
SET AUTOCOMMIT = 0;
--let $statement= CREATE TEMPORARY TABLE t1 (a INT) ENGINE = InnoDB
--source extra/binlog_tests/enforce_gtid_consistency_statement.inc
SET AUTOCOMMIT = 1;
DROP TEMPORARY TABLE IF EXISTS t1;

--echo ---- CREATE TEMPORARY in trx (MyISAM, AUTOCOMMIT=0) ----
--let $statement_ends_transaction= 1
--let $statement_ends_transaction_row= 0
SET AUTOCOMMIT = 0;
--let $statement= CREATE TEMPORARY TABLE t1 (a INT) ENGINE = MyISAM
--source extra/binlog_tests/enforce_gtid_consistency_statement.inc
SET AUTOCOMMIT = 1;
DROP TEMPORARY TABLE IF EXISTS t1;

--echo ---- DROP TEMPORARY in trx (InnoDB, BEGIN) ----
--let $statement_ends_transaction= 0
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (a INT) ENGINE = InnoDB;
--let $pre_statement= BEGIN
--let $statement= DROP TEMPORARY TABLE t1
--source extra/binlog_tests/enforce_gtid_consistency_statement.inc

--echo ---- DROP TEMPORARY in trx (MyISAM, BEGIN) ----
--let $statement_ends_transaction= 1
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (a INT) ENGINE = MyISAM;
--let $pre_statement= BEGIN
--let $statement= DROP TEMPORARY TABLE t1
--source extra/binlog_tests/enforce_gtid_consistency_statement.inc

--echo ---- DROP TEMPORARY in trx (InnoDB, AUTOCOMMIT=0) ----
--let $statement_ends_transaction= 0
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (a INT) ENGINE = InnoDB;
SET AUTOCOMMIT = 0;
--let $statement= DROP TEMPORARY TABLE t1
--source extra/binlog_tests/enforce_gtid_consistency_statement.inc
SET AUTOCOMMIT = 1;

--echo ---- DROP TEMPORARY in trx (MyISAM, AUTOCOMMIT=0) ----
--let $statement_ends_transaction= 1
CREATE TEMPORARY TABLE IF NOT EXISTS t1 (a INT) ENGINE = MyISAM;
SET AUTOCOMMIT = 0;
--let $statement= DROP TEMPORARY TABLE t1
--source extra/binlog_tests/enforce_gtid_consistency_statement.inc
SET AUTOCOMMIT = 1;
DROP TEMPORARY TABLE IF EXISTS t1;
