mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
WL#5151: Conversion between different types when replicating
Row-based replication requires the types of columns on the master and slave to be approximately the same (some safe conversions between strings are allowed), but does not allow safe conversions between fields of similar types such as TINYINT and INT. This patch implement type conversions between similar fields on the master and slave. The conversions are controlled using a new variable SLAVE_TYPE_CONVERSIONS of type SET('ALL_LOSSY','ALL_NON_LOSSY'). Non-lossy conversions are any conversions that do not run the risk of losing any information, while lossy conversions can potentially truncate the value. The column definitions are checked to decide if the conversion is acceptable. If neither conversion is enabled, it is required that the definitions of the columns are identical on master and slave. Conversion is done by creating an internal conversion table, unpacking the master data into it, and then copy the data to the real table on the slave.
This commit is contained in:
52
mysql-test/extra/rpl_tests/check_type.inc
Normal file
52
mysql-test/extra/rpl_tests/check_type.inc
Normal file
@@ -0,0 +1,52 @@
|
||||
# Helper file to perform one insert of a value into a table with
|
||||
# different types on master and slave. The file will insert the
|
||||
# result into the type_conversions table *on the slave* to get a
|
||||
# summary of failing and succeeding tests.
|
||||
|
||||
# Input:
|
||||
# $source_type Type on the master
|
||||
# $target_type Type on the slave
|
||||
# $source_value Value on the master (inserted into the table)
|
||||
# $target_value Value on the slave (expected value in the table
|
||||
# on the slave)
|
||||
# $can_convert True if conversion shall work, false if it
|
||||
# shall generate an error
|
||||
|
||||
|
||||
connection master;
|
||||
disable_warnings;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
enable_warnings;
|
||||
eval CREATE TABLE t1 (a $source_type);
|
||||
sync_slave_with_master;
|
||||
eval ALTER TABLE t1 MODIFY a $target_type;
|
||||
|
||||
connection master;
|
||||
eval INSERT INTO t1 VALUES($source_value);
|
||||
if ($can_convert) {
|
||||
sync_slave_with_master;
|
||||
eval SELECT a = $target_value into @compare FROM t1;
|
||||
eval INSERT INTO type_conversions SET
|
||||
Source = "$source_type",
|
||||
Target = "$target_type",
|
||||
Flags = @@slave_type_conversions,
|
||||
On_Master = $source_value,
|
||||
Expected = $target_value,
|
||||
Compare = @compare;
|
||||
UPDATE type_conversions
|
||||
SET On_Slave = (SELECT a FROM t1)
|
||||
WHERE TestNo = LAST_INSERT_ID();
|
||||
}
|
||||
if (!$can_convert) {
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
let $error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
eval INSERT INTO type_conversions SET
|
||||
Source = "$source_type",
|
||||
Target = "$target_type",
|
||||
Flags = @@slave_type_conversions,
|
||||
On_Master = $source_value,
|
||||
Error = "$error";
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
||||
START SLAVE;
|
||||
}
|
@@ -36,6 +36,9 @@ sync_slave_with_master;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
SET @saved_slave_type_conversions = @@slave_type_conversions;
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
|
||||
|
||||
eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
||||
d FLOAT DEFAULT '2.00',
|
||||
e CHAR(4) DEFAULT 'TEST')
|
||||
@@ -62,6 +65,8 @@ SELECT * FROM t1 ORDER BY a;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
|
||||
--echo *** Drop t1 ***
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
@@ -495,7 +500,7 @@ sync_slave_with_master;
|
||||
--echo *** Create t11 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
|
||||
eval CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
|
||||
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t11 on Master ***
|
||||
|
@@ -6,6 +6,7 @@
|
||||
# First we test tables with only an index.
|
||||
#
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
@@ -156,6 +157,12 @@ SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5
|
||||
# Testing special column types
|
||||
#
|
||||
|
||||
if (`select char_length('$bit_field_special') > 0`) {
|
||||
SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
|
||||
connection slave;
|
||||
eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
|
||||
}
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ;
|
||||
|
||||
@@ -164,6 +171,10 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||
sync_slave_with_master;
|
||||
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||
|
||||
if (`select char_length('$bit_field_special') > 0`) {
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
}
|
||||
|
||||
#
|
||||
# Testing conflicting operations
|
||||
#
|
||||
@@ -350,6 +361,10 @@ eval CREATE TABLE t7 (i INT NOT NULL,
|
||||
c CHAR(255) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
connection slave;
|
||||
SET @saved_slave_type_conversions = @@slave_type_conversions;
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, "", 1);
|
||||
@@ -370,17 +385,9 @@ let $diff_table_1=master:test.t2;
|
||||
let $diff_table_2=slave:test.t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo [expecting slave to stop]
|
||||
connection master;
|
||||
INSERT INTO t3 VALUES (1, "", 1);
|
||||
INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
|
||||
|
||||
connection slave;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
disable_query_log;
|
||||
eval SELECT "$last_error" AS Last_SQL_Error;
|
||||
enable_query_log;
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
@@ -600,7 +607,15 @@ sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
|
||||
# Since t1 contain a bit field, we have to do this trick to handle InnoDB
|
||||
if (`select char_length('$bit_field_special') > 0`) {
|
||||
SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
|
||||
connection slave;
|
||||
eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
|
||||
}
|
||||
|
||||
--disable_warnings
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a bit) ENGINE=$type;
|
||||
INSERT IGNORE INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 ( a ) VALUES ( 0 );
|
||||
@@ -645,6 +660,10 @@ UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
if (`select char_length('$bit_field_special') > 0`) {
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
}
|
||||
|
||||
let $diff_table_1=master:test.t1;
|
||||
let $diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
710
mysql-test/extra/rpl_tests/type_conversions.test
Normal file
710
mysql-test/extra/rpl_tests/type_conversions.test
Normal file
@@ -0,0 +1,710 @@
|
||||
# File containing different lossy and non-lossy type conversions.
|
||||
|
||||
# Integral conversion testing, we do not reduce the test using
|
||||
# transitivity of conversions since the implementation is not using a
|
||||
# transitivity strategy. Instead we do an exhaustive testing.
|
||||
|
||||
disable_query_log;
|
||||
connection slave;
|
||||
--let $conv = `select @@slave_type_conversions`
|
||||
--echo **** Running tests with @@SLAVE_TYPE_CONVERSIONS = '$conv' ****
|
||||
|
||||
let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
|
||||
let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
|
||||
|
||||
let $source_type = BIT(1);
|
||||
let $target_type = BIT(1);
|
||||
let $source_value = b'1';
|
||||
let $target_value = b'1';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = DATE;
|
||||
let $target_type = DATE;
|
||||
let $source_value = '2009-11-21';
|
||||
let $target_value = '2009-11-21';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = ENUM('master','slave');
|
||||
let $target_type = ENUM('master','slave');
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = CHAR(10);
|
||||
let $target_type = ENUM('master','slave');
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = CHAR(10);
|
||||
let $target_type = SET('master','slave');
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = ENUM('master','slave');
|
||||
let $target_type = CHAR(10);
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('master','slave');
|
||||
let $target_type = CHAR(10);
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('master','slave');
|
||||
let $target_type = SET('master','slave');
|
||||
let $source_value = '';
|
||||
let $target_value = '';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('master','slave');
|
||||
let $target_type = SET('master','slave');
|
||||
let $source_value = 'master,slave';
|
||||
let $target_value = 'master,slave';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = TINYINT;
|
||||
let $target_type = TINYINT;
|
||||
let $source_value = 1;
|
||||
let $target_value = 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = TINYINT;
|
||||
let $target_type = SMALLINT;
|
||||
let $source_value = 1;
|
||||
let $target_value = 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYINT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYINT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYINT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1 << 9;
|
||||
let $target_value= (1 << 7) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= TINYINT UNSIGNED;
|
||||
let $source_value= 1 << 9;
|
||||
let $target_value= (1 << 8) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= SMALLINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1 << 20;
|
||||
let $target_value= (1 << 7) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= TINYINT UNSIGNED;
|
||||
let $source_value= 1 << 20;
|
||||
let $target_value= (1 << 8) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= SMALLINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= (1 << 30);
|
||||
let $target_value= (1 << 7) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= TINYINT UNSIGNED;
|
||||
let $source_value= (1 << 30);
|
||||
let $target_value= (1 << 8) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= SMALLINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= SMALLINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= CHAR(20);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= CHAR(30);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= CHAR(10);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnood';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= VARCHAR(20);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= VARCHAR(30);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= VARCHAR(10);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnood';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= TEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= MEDIUMTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= LONGTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= VARCHAR(20);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= VARCHAR(30);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= VARCHAR(10);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnood';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= CHAR(30);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= CHAR(10);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnood';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= TEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= MEDIUMTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= LONGTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $blob = `select repeat('abcd', 125)`;
|
||||
let $truncated_blob = `select left('$blob', 255)`;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= VARCHAR(510);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= VARCHAR(255);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$truncated_blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$truncated_blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= TEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= MEDIUMTEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= LONGTEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $tiny_blob = `select repeat('tiny blob ', 25)`;
|
||||
let $truncated_tiny_blob = `select left('$tiny_blob', 254)`;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= '$tiny_blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TEXT;
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMTEXT;
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= LONGTEXT;
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= CHAR(255);
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= '$tiny_blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= CHAR(250);
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= left('$tiny_blob', 250);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TEXT;
|
||||
let $target_type= CHAR(255);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= left('$blob', 255);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMTEXT;
|
||||
let $target_type= CHAR(255);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= left('$blob', 255);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= LONGTEXT;
|
||||
let $target_type= CHAR(255);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= left('$blob', 255);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= '$tiny_blob';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= TEXT;
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= '$tiny_blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TEXT;
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= left('$blob',255);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(10,5);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.14159;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(10,6);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.141590;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(11,5);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.14159;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(11,6);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.141590;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(10,4);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.1416;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(9,5);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.14159;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(9,4);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.1416;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= FLOAT;
|
||||
let $target_type= DECIMAL(10,5);
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DOUBLE;
|
||||
let $target_type= DECIMAL(10,5);
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= FLOAT;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DOUBLE;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= FLOAT;
|
||||
let $target_type= FLOAT;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DOUBLE;
|
||||
let $target_type= DOUBLE;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= FLOAT;
|
||||
let $target_type= DOUBLE;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DOUBLE;
|
||||
let $target_type= FLOAT;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(5);
|
||||
let $target_type= BIT(5);
|
||||
let $source_value= b'11001';
|
||||
let $target_value= b'11001';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(5);
|
||||
let $target_type= BIT(6);
|
||||
let $source_value= b'11001';
|
||||
let $target_value= b'11001';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(6);
|
||||
let $target_type= BIT(5);
|
||||
let $source_value= b'111001';
|
||||
let $target_value= b'11111';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(5);
|
||||
let $target_type= BIT(12);
|
||||
let $source_value= b'11001';
|
||||
let $target_value= b'11001';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(12);
|
||||
let $target_type= BIT(5);
|
||||
let $source_value= b'101100111000';
|
||||
let $target_value= b'11111';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
disable_warnings;
|
||||
source include/reset_master_and_slave.inc;
|
||||
enable_warnings;
|
||||
enable_query_log;
|
Reference in New Issue
Block a user