Rechercher dans le manuel MySQL
17.4.1.7 Replication of CREATE TABLE ... SELECT Statements
MySQL applies these rules when
CREATE
TABLE ... SELECT
statements are replicated:
CREATE TABLE ... SELECT
always 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 EXISTS
is present.STATEMENT
orMIXED
format: The statement is logged as written.ROW
format: The statement is logged as aCREATE TABLE
statement followed by a series of insert-row events.
If the
CREATE TABLE ... SELECT
statement fails, nothing is logged. This includes the case that the destination table exists andIF NOT EXISTS
is not given.If the destination table exists and
IF NOT EXISTS
is 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
CREATE
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
CREATE
TABLE ... SELECT
.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-replication-features-create-select.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.