10bet网址
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr)- 41.5Mb
PDF (A4)- 41.6Mb
Man Pages (TGZ)- 262.2Kb
Man Pages (Zip)- 372.3Kb
Info (Gzip)- 4.0Mb
Info (Zip)- 4.0Mb
Excerpts from this Manual

17.5.1.7 Replication of CREATE TABLE ... SELECT Statements

MySQL applies these rules whenCREATE TABLE ... SELECTstatements 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 whetherIF NOT EXISTSis present.

    • STATEMENTorMIXEDformat: The statement is logged as written.

    • ROWformat: The statement is logged as aCREATE TABLEstatement followed by a series of insert-row events.

      Prior to MySQL 8.0.21, the statement is logged as two transactions. As of MySQL 8.0.21, on storage engines that support atomic DDL, it is logged as one transaction. For more information, seeSection 13.1.1, “Atomic Data Definition Statement Support”.

  • If theCREATE TABLE ... SELECTstatement fails, nothing is logged. This includes the case that the destination table exists andIF NOT EXISTSis not given.

  • If the destination table exists andIF NOT EXISTSis given, MySQL 8.0 ignores the statement completely; nothing is inserted or logged.

MySQL 8.0 does not allow aCREATE TABLE ... SELECT除了声明作出任何改变表the table that is created by the statement.