#################################################################################### # WL#13784 - Create auto_increment PK on table creation when no PK is specified # # # # Test case verifies following FR # # In GIPK mode if primary key is generated for a non-PK table then query string # # CREATE TABLE ... SELECT must be re-written to include generated primary key # # definition in the binlog event to replicate table correctly in the RBR mode. # # # # - In SBR mode, CREATE TABLE ... SELECT with GIPK can *not* be replicated # # safely so an error is reported in this case. # # # # Case : Verify CREATE TABLE ... SELECT without primary key. An error is reported # # in this case. # # Source: @sql_generate_invisible_primary_key = ON. # # Create table using CREATE TABLE ... SELECT without explicit # # primary key. # # Error should be reported in this case. # # # #################################################################################### --source include/have_binlog_format_statement.inc --source include/master-slave.inc SET @saved_session_sql_generate_invisible_primary_key = @@session.sql_generate_invisible_primary_key; SET SESSION sql_generate_invisible_primary_key = ON; --echo # Verify CREATE TABLE ... SELECT without an explicit primary key. --echo # An error is generated in this case. CREATE TABLE t1(f1 INT, f2 INT); INSERT INTO t1 VALUES (1, 10), (2, 20); --error ER_CREATE_SELECT_WITH_GIPK_DISALLOWED_IN_SBR CREATE TABLE t2 AS SELECT * FROM t1; --error ER_CREATE_SELECT_WITH_GIPK_DISALLOWED_IN_SBR CREATE TEMPORARY TABLE t2 AS SELECT * FROM t1; --source include/rpl_connection_master.inc DROP TABLE t1; SET SESSION sql_generate_invisible_primary_key = @saved_session_sql_generate_invisible_primary_key; --source include/rpl_end.inc