diff options
author | Alexander Barkov <bar@mariadb.com> | 2020-07-08 08:31:32 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2020-08-01 07:43:50 +0400 |
commit | d63631c3fa333373d94271d5f68196a4ecec76de (patch) | |
tree | 7482067b4521c4c6b9598cbacf8083d10ef940e5 /sql/sql_lex.h | |
parent | a8458a2345ea2497ada2f1bd01aeb9c34934dfc6 (diff) | |
download | mariadb-git-d63631c3fa333373d94271d5f68196a4ecec76de.tar.gz |
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.
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r-- | sql/sql_lex.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 8b8a55e0c96..55929ed7df6 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -32,6 +32,7 @@ #include "sp.h" // enum stored_procedure_type #include "sql_tvc.h" #include "item.h" +#include "sql_schema.h" /* Used for flags of nesting constructs */ #define SELECT_NESTING_MAP_SIZE 64 @@ -2144,6 +2145,7 @@ private: struct st_parsing_options { bool allows_variable; + bool lookup_keywords_after_qualifier; st_parsing_options() { reset(); } void reset(); @@ -4052,6 +4054,9 @@ public: bool tvc_finalize(); bool tvc_finalize_derived(); + bool map_data_type(const Lex_ident_sys_st &schema, + Lex_field_type_st *type) const; + void mark_first_table_as_inserting(); }; |