Pre-General Availability Draft: 2018-03-18
MySQL applies these rules when
TABLE ... SELECT statements are replicated:
CREATE TABLE ... SELECTalways performs an implicit commit (Section 13.3.3, “Statements That Cause an Implicit Commit”).
If the destination table does not exist, logging occurs as follows. It does not matter whether
IF NOT EXISTSis present.
MIXEDformat: The statement is logged as written.
ROWformat: The statement is logged as a
CREATE TABLEstatement followed by a series of insert-row events.
CREATE TABLE ... SELECTstatement fails, nothing is logged. This includes the case that the destination table exists and
IF NOT EXISTSis not given.
If the destination table exists and
IF NOT EXISTSis given, MySQL 8.0 ignores the statement completely; nothing is inserted or logged.
When statement-based replication is in use, MySQL
8.0 does not allow a
TABLE ... SELECT statement to make any changes in
tables other than the table that is created by the statement.
This is not an issue when using row-based replication, because
the statement is logged as a
CREATE TABLE statement
with any changes to table data logged as row-insert events,
rather than as the entire
TABLE ... SELECT.