mirror of
https://github.com/MariaDB/server.git
synced 2025-07-26 07:02:12 +03:00
- 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.
39 lines
729 B
Plaintext
39 lines
729 B
Plaintext
--source include/have_binlog_format_row.inc
|
|
--source include/master-slave.inc
|
|
|
|
SET SQL_MODE=DEFAULT;
|
|
CREATE TABLE t1 (a DATE);
|
|
INSERT INTO t1 VALUES (NULL);
|
|
INSERT INTO t1 VALUES ('2001-01-01');
|
|
|
|
SET SQL_MODE= ORACLE;
|
|
CREATE TABLE t2 SELECT * FROM t1;
|
|
|
|
--let $binlog_file = LAST
|
|
source include/show_binlog_events.inc;
|
|
|
|
SET SQL_MODE= DEFAULT;
|
|
SHOW CREATE TABLE t1;
|
|
SHOW CREATE TABLE t2;
|
|
|
|
SET SQL_MODE= ORACLE;
|
|
SHOW CREATE TABLE t1;
|
|
SHOW CREATE TABLE t2;
|
|
|
|
--sync_slave_with_master
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
|
|
SET SQL_MODE= DEFAULT;
|
|
SHOW CREATE TABLE t1;
|
|
SHOW CREATE TABLE t2;
|
|
|
|
SET SQL_MODE= ORACLE;
|
|
SHOW CREATE TABLE t1;
|
|
SHOW CREATE TABLE t2;
|
|
|
|
# Cleanup
|
|
--connection master
|
|
DROP TABLE t1, t2;
|
|
--source include/rpl_end.inc
|