summaryrefslogtreecommitdiff
path: root/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result')
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result195
1 files changed, 195 insertions, 0 deletions
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result
new file mode 100644
index 00000000000..c045bbe7769
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_decimal.result
@@ -0,0 +1,195 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER
+#
+CREATE TABLE t1 (target INET6 DEFAULT '::0', source DECIMAL(38,0) DEFAULT 0);
+# Start of type_store_assignment_incompatible.inc
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` inet6 DEFAULT '::',
+ `source` decimal(38,0) DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1292 Incorrect inet6 value: '0' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 :: 0
+2 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Got one of the listed errors
+SELECT * FROM v3;
+id target source
+1 :: 0
+TRUNCATE TABLE t3;
+SET sql_mode=DEFAULT;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+UPDATE t3 SET target=source;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target decimal(38,0)
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+DROP TABLE t3;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source INET6 DEFAULT '::0');
+# Start of type_store_assignment_incompatible.inc
+SET @source_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='source'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+SET @target_type= (SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
+WHERE COLUMN_NAME='target'
+ AND TABLE_NAME='t1'
+ AND TABLE_SCHEMA='test');
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 ADD id INT NOT NULL PRIMARY KEY FIRST;
+INSERT INTO t2 VALUES (1,DEFAULT,DEFAULT);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `target` decimal(38,0) DEFAULT 0,
+ `source` inet6 DEFAULT '::',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 VALUES
+(1,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+DROP TABLE t3;
+SET sql_mode='';
+CREATE TABLE t3 LIKE t2;
+ALTER TABLE t3 ENGINE=MyISAM;
+EXECUTE IMMEDIATE
+CONCAT('CREATE VIEW v3 AS SELECT id,',
+IF(@target_type='geometry','AsText(target)','target'), ' AS target,',
+IF(@source_type='geometry','AsText(source)','source'), ' AS source ',
+' FROM t3');
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Warnings:
+Warning 1366 Incorrect decimal value: '::' for column `test`.`t3`.`target` at row 2
+SELECT * FROM v3;
+id target source
+1 0 ::
+2 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=STRICT_ALL_TABLES;
+INSERT INTO t3 VALUES
+(1,
+(SELECT target FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1)),
+(2,
+(SELECT source FROM t2 ORDER BY id LIMIT 1),
+(SELECT source FROM t2 ORDER BY id LIMIT 1));
+Got one of the listed errors
+SELECT * FROM v3;
+id target source
+1 0 ::
+TRUNCATE TABLE t3;
+SET sql_mode=DEFAULT;
+DROP TABLE t3;
+DROP VIEW v3;
+CREATE TABLE t3 LIKE t2;
+INSERT INTO t3 SELECT id,source,source FROM t2;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+INSERT INTO t3 (id,target,source) SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+UPDATE t3 SET target=source;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id;
+ERROR HY000: Illegal parameter data types decimal and inet6 for operation 'SET'
+SET @alter=CONCAT('ALTER TABLE t3 MODIFY target ', @source_type);
+SELECT @alter;
+@alter
+ALTER TABLE t3 MODIFY target inet6
+EXECUTE IMMEDIATE @alter;
+ERROR HY000: Illegal parameter data types inet6 and decimal for operation 'SET'
+DROP TABLE t3;
+DROP TABLE t2;
+# End of type_store_assignment_incompatible.inc
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#