From d63631c3fa333373d94271d5f68196a4ecec76de Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 8 Jul 2020 08:31:32 +0400 Subject: MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode - Adding optional qualifiers to data types: CREATE TABLE t1 (a schema.DATE); Qualifiers now work only for three pre-defined schemas: mariadb_schema oracle_schema maxdb_schema These schemas are virtual (hard-coded) for now, but may turn into real databases on disk in the future. - mariadb_schema.TYPE now always resolves to a true MariaDB data type TYPE without sql_mode specific translations. - oracle_schema.DATE translates to MariaDB DATETIME. - maxdb_schema.TIMESTAMP translates to MariaDB DATETIME. - Fixing SHOW CREATE TABLE to use a qualifier for a data type TYPE if the current sql_mode translates TYPE to something else. The above changes fix the reported problem, so this script: SET sql_mode=ORACLE; CREATE TABLE t2 AS SELECT mariadb_date_column FROM t1; is now replicated as: SET sql_mode=ORACLE; CREATE TABLE t2 (mariadb_date_column mariadb_schema.DATE); and the slave can unambiguously treat DATE as the true MariaDB DATE without ORACLE specific translation to DATETIME. Similar, SET sql_mode=MAXDB; CREATE TABLE t2 AS SELECT mariadb_timestamp_column FROM t1; is now replicated as: SET sql_mode=MAXDB; CREATE TABLE t2 (mariadb_timestamp_column mariadb_schema.TIMESTAMP); so the slave treats TIMESTAMP as the true MariaDB TIMESTAMP without MAXDB specific translation to DATETIME. --- sql/structs.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sql/structs.h') diff --git a/sql/structs.h b/sql/structs.h index 12bd568d7c5..351847d00ec 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -610,6 +610,10 @@ public: { set(handler, 0, 0); } + void set_handler(const Type_handler *handler) + { + m_handler= handler; + } const Type_handler *type_handler() const { return m_handler; } }; -- cgit v1.2.1