diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
commit | 06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /plugin/type_uuid/mysql-test | |
parent | Initial commit. (diff) | |
download | mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugin/type_uuid/mysql-test')
53 files changed, 11248 insertions, 0 deletions
diff --git a/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.result new file mode 100644 index 00000000..a0e5a3af --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.result @@ -0,0 +1,37 @@ +# +# MDEV-4958 Adding datatype UUID +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); +PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)'; +EXECUTE stmt USING CAST('00000000-0000-0000-0000-000000000001' AS UUID); +EXECUTE stmt USING CAST(CONCAT(REPEAT(0x00,15), 0x02) AS UUID); +DEALLOCATE PREPARE stmt; +BEGIN NOT ATOMIC +DECLARE a UUID DEFAULT '00000000-0000-0000-0000-000000000003'; +INSERT INTO t1 VALUES (a); +END; +$$ +DROP TABLE t1; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a UUID) +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000') +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff') +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001') +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000002') +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES ( NAME_CONST('a','00000000-0000-0000-0000-000000000003')) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ diff --git a/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.test new file mode 100644 index 00000000..2c2dd958 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/binlog_stm_type_uuid.test @@ -0,0 +1,32 @@ +--source include/not_embedded.inc +--source include/have_binlog_format_statement.inc + +--disable_query_log +reset master; # get rid of previous tests binlog +--enable_query_log + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); + +PREPARE stmt FROM 'INSERT INTO t1 VALUES (?)'; +EXECUTE stmt USING CAST('00000000-0000-0000-0000-000000000001' AS UUID); +EXECUTE stmt USING CAST(CONCAT(REPEAT(0x00,15), 0x02) AS UUID); +DEALLOCATE PREPARE stmt; + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a UUID DEFAULT '00000000-0000-0000-0000-000000000003'; + INSERT INTO t1 VALUES (a); +END; +$$ +DELIMITER ;$$ + +DROP TABLE t1; + +--let $binlog_file = LAST +source include/show_binlog_events.inc; diff --git a/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.result new file mode 100644 index 00000000..3932470c --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.result @@ -0,0 +1,60 @@ +# +# Start of 10.5 tests +# +# +# MDEV-4958 Adding datatype UUID +# +# Using DEFAULT_CHARSET format +RESET MASTER; +SET GLOBAL binlog_row_metadata = NO_LOG; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES('123e4567-e89b-12d3-a456-426655440000'); +# Columns(BINARY(16)) +DROP TABLE t1; +RESET MASTER; +RESET MASTER; +SET GLOBAL binlog_row_metadata = MINIMAL; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000'); +# Columns(BINARY(16)) +DROP TABLE t1; +RESET MASTER; +RESET MASTER; +SET GLOBAL binlog_row_metadata = FULL; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000'); +# Columns(`a` BINARY(16)) +DROP TABLE t1; +RESET MASTER; +# Using COLUMN_CHARSET format +RESET MASTER; +SET GLOBAL binlog_row_metadata = NO_LOG; +CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','',''); +# Columns(BINARY(16), +# BINARY(16), +# BINARY(48)) +DROP TABLE t1; +RESET MASTER; +RESET MASTER; +SET GLOBAL binlog_row_metadata = MINIMAL; +CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','',''); +# Columns(BINARY(16), +# CHAR(16) CHARSET latin1 COLLATE latin1_swedish_ci, +# CHAR(16) CHARSET utf8mb3 COLLATE utf8mb3_general_ci) +DROP TABLE t1; +RESET MASTER; +RESET MASTER; +SET GLOBAL binlog_row_metadata = FULL; +CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','',''); +# Columns(`a` BINARY(16), +# `b` CHAR(16) CHARSET latin1 COLLATE latin1_swedish_ci, +# `c` CHAR(16) CHARSET utf8mb3 COLLATE utf8mb3_general_ci) +DROP TABLE t1; +RESET MASTER; +SET GLOBAL binlog_row_metadata = DEFAULT; +# +# End of 10.5 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.test new file mode 100644 index 00000000..aa525123 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/binlog_table_map_optional_metadata_type_uuid.test @@ -0,0 +1,72 @@ +--source include/have_debug.inc +--source include/have_binlog_format_row.inc + +--let $MYSQLD_DATADIR= `select @@datadir` +--let $binlog_file= $MYSQLD_DATADIR/master-bin.000001 + + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +--echo # Using DEFAULT_CHARSET format + +RESET MASTER; +SET GLOBAL binlog_row_metadata = NO_LOG; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES('123e4567-e89b-12d3-a456-426655440000'); +--source suite/binlog/include/print_optional_metadata.inc +DROP TABLE t1; +RESET MASTER; + +RESET MASTER; +SET GLOBAL binlog_row_metadata = MINIMAL; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000'); +--source suite/binlog/include/print_optional_metadata.inc +DROP TABLE t1; +RESET MASTER; + +RESET MASTER; +SET GLOBAL binlog_row_metadata = FULL; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000'); +--source suite/binlog/include/print_optional_metadata.inc +DROP TABLE t1; +RESET MASTER; + +--echo # Using COLUMN_CHARSET format + +RESET MASTER; +SET GLOBAL binlog_row_metadata = NO_LOG; +CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','',''); +--source suite/binlog/include/print_optional_metadata.inc +DROP TABLE t1; +RESET MASTER; + +RESET MASTER; +SET GLOBAL binlog_row_metadata = MINIMAL; +CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','',''); +--source suite/binlog/include/print_optional_metadata.inc +DROP TABLE t1; +RESET MASTER; + +RESET MASTER; +SET GLOBAL binlog_row_metadata = FULL; +CREATE TABLE t1 (a UUID, b CHAR(16) CHARACTER SET latin1, c CHAR(16) CHARACTER SET utf8); +INSERT INTO t1 VALUES('12334567-8888-9999-aaaa-000000000000','',''); +--source suite/binlog/include/print_optional_metadata.inc +DROP TABLE t1; +RESET MASTER; + +SET GLOBAL binlog_row_metadata = DEFAULT; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result new file mode 100644 index 00000000..716f3313 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.result @@ -0,0 +1,35 @@ +# +# Start of 10.5 tests +# +# +# MDEV-4958 Adding datatype UUID +# +SELECT +'----' AS `----`, +PLUGIN_NAME, +PLUGIN_VERSION, +PLUGIN_STATUS, +PLUGIN_TYPE, +PLUGIN_AUTHOR, +PLUGIN_DESCRIPTION, +PLUGIN_LICENSE, +PLUGIN_MATURITY, +PLUGIN_AUTH_VERSION +FROM INFORMATION_SCHEMA.PLUGINS +WHERE PLUGIN_TYPE='FUNCTION' + AND PLUGIN_NAME IN +('uuid') +ORDER BY PLUGIN_NAME; +---- ---- +PLUGIN_NAME uuid +PLUGIN_VERSION 1.0 +PLUGIN_STATUS ACTIVE +PLUGIN_TYPE FUNCTION +PLUGIN_AUTHOR MariaDB Corporation +PLUGIN_DESCRIPTION Function UUID() +PLUGIN_LICENSE GPL +PLUGIN_MATURITY Stable +PLUGIN_AUTH_VERSION 1.0 +# +# End of 10.5 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.test b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.test new file mode 100644 index 00000000..ce8aba68 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/func_uuid_plugin.test @@ -0,0 +1,30 @@ +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +--vertical_results +SELECT + '----' AS `----`, + PLUGIN_NAME, + PLUGIN_VERSION, + PLUGIN_STATUS, + PLUGIN_TYPE, + PLUGIN_AUTHOR, + PLUGIN_DESCRIPTION, + PLUGIN_LICENSE, + PLUGIN_MATURITY, + PLUGIN_AUTH_VERSION +FROM INFORMATION_SCHEMA.PLUGINS +WHERE PLUGIN_TYPE='FUNCTION' + AND PLUGIN_NAME IN + ('uuid') +ORDER BY PLUGIN_NAME; +--horizontal_results + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/order.result b/plugin/type_uuid/mysql-test/type_uuid/order.result new file mode 100644 index 00000000..3dd799b6 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/order.result @@ -0,0 +1,833 @@ +create table t1 (a uuid, b int not null, index (a)); +insert t1 select sformat('{:03}01234-5566-{:x}777-{}888-99aabbccddee', +(seq % 2)*100 + seq, seq div 4, elt(1+(seq % 4),0,8,'c','e')),seq from seq_0_to_63; +Warnings: +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 33 +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 37 +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 41 +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 45 +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 49 +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 53 +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 57 +Warning 1292 Incorrect uuid value: '06001234-5566-f777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 61 +select * from t1 order by b; +a b +00001234-5566-0777-0888-99aabbccddee 0 +10101234-5566-0777-8888-99aabbccddee 1 +00201234-5566-0777-c888-99aabbccddee 2 +10301234-5566-0777-e888-99aabbccddee 3 +00401234-5566-1777-0888-99aabbccddee 4 +10501234-5566-1777-8888-99aabbccddee 5 +00601234-5566-1777-c888-99aabbccddee 6 +10701234-5566-1777-e888-99aabbccddee 7 +00801234-5566-2777-0888-99aabbccddee 8 +10901234-5566-2777-8888-99aabbccddee 9 +01001234-5566-2777-c888-99aabbccddee 10 +11101234-5566-2777-e888-99aabbccddee 11 +01201234-5566-3777-0888-99aabbccddee 12 +11301234-5566-3777-8888-99aabbccddee 13 +01401234-5566-3777-c888-99aabbccddee 14 +11501234-5566-3777-e888-99aabbccddee 15 +01601234-5566-4777-0888-99aabbccddee 16 +11701234-5566-4777-8888-99aabbccddee 17 +01801234-5566-4777-c888-99aabbccddee 18 +11901234-5566-4777-e888-99aabbccddee 19 +02001234-5566-5777-0888-99aabbccddee 20 +12101234-5566-5777-8888-99aabbccddee 21 +02201234-5566-5777-c888-99aabbccddee 22 +12301234-5566-5777-e888-99aabbccddee 23 +02401234-5566-6777-0888-99aabbccddee 24 +12501234-5566-6777-8888-99aabbccddee 25 +02601234-5566-6777-c888-99aabbccddee 26 +12701234-5566-6777-e888-99aabbccddee 27 +02801234-5566-7777-0888-99aabbccddee 28 +12901234-5566-7777-8888-99aabbccddee 29 +03001234-5566-7777-c888-99aabbccddee 30 +13101234-5566-7777-e888-99aabbccddee 31 +NULL 32 +13301234-5566-8777-8888-99aabbccddee 33 +03401234-5566-8777-c888-99aabbccddee 34 +13501234-5566-8777-e888-99aabbccddee 35 +NULL 36 +13701234-5566-9777-8888-99aabbccddee 37 +03801234-5566-9777-c888-99aabbccddee 38 +13901234-5566-9777-e888-99aabbccddee 39 +NULL 40 +14101234-5566-a777-8888-99aabbccddee 41 +04201234-5566-a777-c888-99aabbccddee 42 +14301234-5566-a777-e888-99aabbccddee 43 +NULL 44 +14501234-5566-b777-8888-99aabbccddee 45 +04601234-5566-b777-c888-99aabbccddee 46 +14701234-5566-b777-e888-99aabbccddee 47 +NULL 48 +14901234-5566-c777-8888-99aabbccddee 49 +05001234-5566-c777-c888-99aabbccddee 50 +15101234-5566-c777-e888-99aabbccddee 51 +NULL 52 +15301234-5566-d777-8888-99aabbccddee 53 +05401234-5566-d777-c888-99aabbccddee 54 +15501234-5566-d777-e888-99aabbccddee 55 +NULL 56 +15701234-5566-e777-8888-99aabbccddee 57 +05801234-5566-e777-c888-99aabbccddee 58 +15901234-5566-e777-e888-99aabbccddee 59 +NULL 60 +16101234-5566-f777-8888-99aabbccddee 61 +06201234-5566-f777-c888-99aabbccddee 62 +16301234-5566-f777-e888-99aabbccddee 63 +select * from t1 order by a; +a b +NULL 40 +NULL 32 +NULL 36 +NULL 44 +NULL 48 +NULL 52 +NULL 56 +NULL 60 +00001234-5566-0777-0888-99aabbccddee 0 +00401234-5566-1777-0888-99aabbccddee 4 +00801234-5566-2777-0888-99aabbccddee 8 +01201234-5566-3777-0888-99aabbccddee 12 +01601234-5566-4777-0888-99aabbccddee 16 +02001234-5566-5777-0888-99aabbccddee 20 +02401234-5566-6777-0888-99aabbccddee 24 +02601234-5566-6777-c888-99aabbccddee 26 +02801234-5566-7777-0888-99aabbccddee 28 +03001234-5566-7777-c888-99aabbccddee 30 +03401234-5566-8777-c888-99aabbccddee 34 +03801234-5566-9777-c888-99aabbccddee 38 +04201234-5566-a777-c888-99aabbccddee 42 +04601234-5566-b777-c888-99aabbccddee 46 +05001234-5566-c777-c888-99aabbccddee 50 +05401234-5566-d777-c888-99aabbccddee 54 +05801234-5566-e777-c888-99aabbccddee 58 +06201234-5566-f777-c888-99aabbccddee 62 +12501234-5566-6777-8888-99aabbccddee 25 +12701234-5566-6777-e888-99aabbccddee 27 +12901234-5566-7777-8888-99aabbccddee 29 +13101234-5566-7777-e888-99aabbccddee 31 +13301234-5566-8777-8888-99aabbccddee 33 +13501234-5566-8777-e888-99aabbccddee 35 +13701234-5566-9777-8888-99aabbccddee 37 +13901234-5566-9777-e888-99aabbccddee 39 +14101234-5566-a777-8888-99aabbccddee 41 +14301234-5566-a777-e888-99aabbccddee 43 +14501234-5566-b777-8888-99aabbccddee 45 +14701234-5566-b777-e888-99aabbccddee 47 +14901234-5566-c777-8888-99aabbccddee 49 +15101234-5566-c777-e888-99aabbccddee 51 +15301234-5566-d777-8888-99aabbccddee 53 +15501234-5566-d777-e888-99aabbccddee 55 +15701234-5566-e777-8888-99aabbccddee 57 +15901234-5566-e777-e888-99aabbccddee 59 +16101234-5566-f777-8888-99aabbccddee 61 +16301234-5566-f777-e888-99aabbccddee 63 +10101234-5566-0777-8888-99aabbccddee 1 +10501234-5566-1777-8888-99aabbccddee 5 +10901234-5566-2777-8888-99aabbccddee 9 +11301234-5566-3777-8888-99aabbccddee 13 +11701234-5566-4777-8888-99aabbccddee 17 +12101234-5566-5777-8888-99aabbccddee 21 +00201234-5566-0777-c888-99aabbccddee 2 +00601234-5566-1777-c888-99aabbccddee 6 +01001234-5566-2777-c888-99aabbccddee 10 +01401234-5566-3777-c888-99aabbccddee 14 +01801234-5566-4777-c888-99aabbccddee 18 +02201234-5566-5777-c888-99aabbccddee 22 +10301234-5566-0777-e888-99aabbccddee 3 +10701234-5566-1777-e888-99aabbccddee 7 +11101234-5566-2777-e888-99aabbccddee 11 +11501234-5566-3777-e888-99aabbccddee 15 +11901234-5566-4777-e888-99aabbccddee 19 +12301234-5566-5777-e888-99aabbccddee 23 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# now let's use the table as above, but created in 10.11.4 +select * from t2 order by b; +a b +00001234-5566-0777-0888-99aabbccddee 0 +10101234-5566-0777-8888-99aabbccddee 1 +00201234-5566-0777-c888-99aabbccddee 2 +10301234-5566-0777-e888-99aabbccddee 3 +00401234-5566-1777-0888-99aabbccddee 4 +10501234-5566-1777-8888-99aabbccddee 5 +00601234-5566-1777-c888-99aabbccddee 6 +10701234-5566-1777-e888-99aabbccddee 7 +00801234-5566-2777-0888-99aabbccddee 8 +10901234-5566-2777-8888-99aabbccddee 9 +01001234-5566-2777-c888-99aabbccddee 10 +11101234-5566-2777-e888-99aabbccddee 11 +01201234-5566-3777-0888-99aabbccddee 12 +11301234-5566-3777-8888-99aabbccddee 13 +01401234-5566-3777-c888-99aabbccddee 14 +11501234-5566-3777-e888-99aabbccddee 15 +01601234-5566-4777-0888-99aabbccddee 16 +11701234-5566-4777-8888-99aabbccddee 17 +01801234-5566-4777-c888-99aabbccddee 18 +11901234-5566-4777-e888-99aabbccddee 19 +02001234-5566-5777-0888-99aabbccddee 20 +12101234-5566-5777-8888-99aabbccddee 21 +02201234-5566-5777-c888-99aabbccddee 22 +12301234-5566-5777-e888-99aabbccddee 23 +02401234-5566-6777-0888-99aabbccddee 24 +12501234-5566-6777-8888-99aabbccddee 25 +02601234-5566-6777-c888-99aabbccddee 26 +12701234-5566-6777-e888-99aabbccddee 27 +02801234-5566-7777-0888-99aabbccddee 28 +12901234-5566-7777-8888-99aabbccddee 29 +03001234-5566-7777-c888-99aabbccddee 30 +13101234-5566-7777-e888-99aabbccddee 31 +03201234-5566-8777-0888-99aabbccddee 32 +13301234-5566-8777-8888-99aabbccddee 33 +03401234-5566-8777-c888-99aabbccddee 34 +13501234-5566-8777-e888-99aabbccddee 35 +03601234-5566-9777-0888-99aabbccddee 36 +13701234-5566-9777-8888-99aabbccddee 37 +03801234-5566-9777-c888-99aabbccddee 38 +13901234-5566-9777-e888-99aabbccddee 39 +04001234-5566-a777-0888-99aabbccddee 40 +14101234-5566-a777-8888-99aabbccddee 41 +04201234-5566-a777-c888-99aabbccddee 42 +14301234-5566-a777-e888-99aabbccddee 43 +04401234-5566-b777-0888-99aabbccddee 44 +14501234-5566-b777-8888-99aabbccddee 45 +04601234-5566-b777-c888-99aabbccddee 46 +14701234-5566-b777-e888-99aabbccddee 47 +04801234-5566-c777-0888-99aabbccddee 48 +14901234-5566-c777-8888-99aabbccddee 49 +05001234-5566-c777-c888-99aabbccddee 50 +15101234-5566-c777-e888-99aabbccddee 51 +05201234-5566-d777-0888-99aabbccddee 52 +15301234-5566-d777-8888-99aabbccddee 53 +05401234-5566-d777-c888-99aabbccddee 54 +15501234-5566-d777-e888-99aabbccddee 55 +05601234-5566-e777-0888-99aabbccddee 56 +15701234-5566-e777-8888-99aabbccddee 57 +05801234-5566-e777-c888-99aabbccddee 58 +15901234-5566-e777-e888-99aabbccddee 59 +06001234-5566-f777-0888-99aabbccddee 60 +16101234-5566-f777-8888-99aabbccddee 61 +06201234-5566-f777-c888-99aabbccddee 62 +16301234-5566-f777-e888-99aabbccddee 63 +select * from t2 order by a; +a b +00001234-5566-0777-0888-99aabbccddee 0 +00401234-5566-1777-0888-99aabbccddee 4 +00801234-5566-2777-0888-99aabbccddee 8 +01201234-5566-3777-0888-99aabbccddee 12 +01601234-5566-4777-0888-99aabbccddee 16 +02001234-5566-5777-0888-99aabbccddee 20 +02401234-5566-6777-0888-99aabbccddee 24 +02801234-5566-7777-0888-99aabbccddee 28 +03201234-5566-8777-0888-99aabbccddee 32 +03601234-5566-9777-0888-99aabbccddee 36 +04001234-5566-a777-0888-99aabbccddee 40 +04401234-5566-b777-0888-99aabbccddee 44 +04801234-5566-c777-0888-99aabbccddee 48 +05201234-5566-d777-0888-99aabbccddee 52 +05601234-5566-e777-0888-99aabbccddee 56 +06001234-5566-f777-0888-99aabbccddee 60 +10101234-5566-0777-8888-99aabbccddee 1 +10501234-5566-1777-8888-99aabbccddee 5 +10901234-5566-2777-8888-99aabbccddee 9 +11301234-5566-3777-8888-99aabbccddee 13 +11701234-5566-4777-8888-99aabbccddee 17 +12101234-5566-5777-8888-99aabbccddee 21 +12501234-5566-6777-8888-99aabbccddee 25 +12901234-5566-7777-8888-99aabbccddee 29 +13301234-5566-8777-8888-99aabbccddee 33 +13701234-5566-9777-8888-99aabbccddee 37 +14101234-5566-a777-8888-99aabbccddee 41 +14501234-5566-b777-8888-99aabbccddee 45 +14901234-5566-c777-8888-99aabbccddee 49 +15301234-5566-d777-8888-99aabbccddee 53 +15701234-5566-e777-8888-99aabbccddee 57 +16101234-5566-f777-8888-99aabbccddee 61 +00201234-5566-0777-c888-99aabbccddee 2 +00601234-5566-1777-c888-99aabbccddee 6 +01001234-5566-2777-c888-99aabbccddee 10 +01401234-5566-3777-c888-99aabbccddee 14 +01801234-5566-4777-c888-99aabbccddee 18 +02201234-5566-5777-c888-99aabbccddee 22 +02601234-5566-6777-c888-99aabbccddee 26 +03001234-5566-7777-c888-99aabbccddee 30 +03401234-5566-8777-c888-99aabbccddee 34 +03801234-5566-9777-c888-99aabbccddee 38 +04201234-5566-a777-c888-99aabbccddee 42 +04601234-5566-b777-c888-99aabbccddee 46 +05001234-5566-c777-c888-99aabbccddee 50 +05401234-5566-d777-c888-99aabbccddee 54 +05801234-5566-e777-c888-99aabbccddee 58 +06201234-5566-f777-c888-99aabbccddee 62 +10301234-5566-0777-e888-99aabbccddee 3 +10701234-5566-1777-e888-99aabbccddee 7 +11101234-5566-2777-e888-99aabbccddee 11 +11501234-5566-3777-e888-99aabbccddee 15 +11901234-5566-4777-e888-99aabbccddee 19 +12301234-5566-5777-e888-99aabbccddee 23 +12701234-5566-6777-e888-99aabbccddee 27 +13101234-5566-7777-e888-99aabbccddee 31 +13501234-5566-8777-e888-99aabbccddee 35 +13901234-5566-9777-e888-99aabbccddee 39 +14301234-5566-a777-e888-99aabbccddee 43 +14701234-5566-b777-e888-99aabbccddee 47 +15101234-5566-c777-e888-99aabbccddee 51 +15501234-5566-d777-e888-99aabbccddee 55 +15901234-5566-e777-e888-99aabbccddee 59 +16301234-5566-f777-e888-99aabbccddee 63 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` uuid DEFAULT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +explain select * from t1 left join t2 on (t1.a=t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 64 +1 SIMPLE t2 ref a a 17 test.t1.a 1 Using where +select * from t1 left join t2 on (t1.a=t2.a); +a b a b +00001234-5566-0777-0888-99aabbccddee 0 00001234-5566-0777-0888-99aabbccddee 0 +00201234-5566-0777-c888-99aabbccddee 2 00201234-5566-0777-c888-99aabbccddee 2 +00401234-5566-1777-0888-99aabbccddee 4 00401234-5566-1777-0888-99aabbccddee 4 +00601234-5566-1777-c888-99aabbccddee 6 00601234-5566-1777-c888-99aabbccddee 6 +00801234-5566-2777-0888-99aabbccddee 8 00801234-5566-2777-0888-99aabbccddee 8 +01001234-5566-2777-c888-99aabbccddee 10 01001234-5566-2777-c888-99aabbccddee 10 +01201234-5566-3777-0888-99aabbccddee 12 01201234-5566-3777-0888-99aabbccddee 12 +01401234-5566-3777-c888-99aabbccddee 14 01401234-5566-3777-c888-99aabbccddee 14 +01601234-5566-4777-0888-99aabbccddee 16 01601234-5566-4777-0888-99aabbccddee 16 +01801234-5566-4777-c888-99aabbccddee 18 01801234-5566-4777-c888-99aabbccddee 18 +02001234-5566-5777-0888-99aabbccddee 20 02001234-5566-5777-0888-99aabbccddee 20 +02201234-5566-5777-c888-99aabbccddee 22 02201234-5566-5777-c888-99aabbccddee 22 +02401234-5566-6777-0888-99aabbccddee 24 02401234-5566-6777-0888-99aabbccddee 24 +02601234-5566-6777-c888-99aabbccddee 26 02601234-5566-6777-c888-99aabbccddee 26 +02801234-5566-7777-0888-99aabbccddee 28 02801234-5566-7777-0888-99aabbccddee 28 +03001234-5566-7777-c888-99aabbccddee 30 03001234-5566-7777-c888-99aabbccddee 30 +03401234-5566-8777-c888-99aabbccddee 34 03401234-5566-8777-c888-99aabbccddee 34 +03801234-5566-9777-c888-99aabbccddee 38 03801234-5566-9777-c888-99aabbccddee 38 +04201234-5566-a777-c888-99aabbccddee 42 04201234-5566-a777-c888-99aabbccddee 42 +04601234-5566-b777-c888-99aabbccddee 46 04601234-5566-b777-c888-99aabbccddee 46 +05001234-5566-c777-c888-99aabbccddee 50 05001234-5566-c777-c888-99aabbccddee 50 +05401234-5566-d777-c888-99aabbccddee 54 05401234-5566-d777-c888-99aabbccddee 54 +05801234-5566-e777-c888-99aabbccddee 58 05801234-5566-e777-c888-99aabbccddee 58 +06201234-5566-f777-c888-99aabbccddee 62 06201234-5566-f777-c888-99aabbccddee 62 +10101234-5566-0777-8888-99aabbccddee 1 10101234-5566-0777-8888-99aabbccddee 1 +10301234-5566-0777-e888-99aabbccddee 3 10301234-5566-0777-e888-99aabbccddee 3 +10501234-5566-1777-8888-99aabbccddee 5 10501234-5566-1777-8888-99aabbccddee 5 +10701234-5566-1777-e888-99aabbccddee 7 10701234-5566-1777-e888-99aabbccddee 7 +10901234-5566-2777-8888-99aabbccddee 9 10901234-5566-2777-8888-99aabbccddee 9 +11101234-5566-2777-e888-99aabbccddee 11 11101234-5566-2777-e888-99aabbccddee 11 +11301234-5566-3777-8888-99aabbccddee 13 11301234-5566-3777-8888-99aabbccddee 13 +11501234-5566-3777-e888-99aabbccddee 15 11501234-5566-3777-e888-99aabbccddee 15 +11701234-5566-4777-8888-99aabbccddee 17 11701234-5566-4777-8888-99aabbccddee 17 +11901234-5566-4777-e888-99aabbccddee 19 11901234-5566-4777-e888-99aabbccddee 19 +12101234-5566-5777-8888-99aabbccddee 21 12101234-5566-5777-8888-99aabbccddee 21 +12301234-5566-5777-e888-99aabbccddee 23 12301234-5566-5777-e888-99aabbccddee 23 +12501234-5566-6777-8888-99aabbccddee 25 12501234-5566-6777-8888-99aabbccddee 25 +12701234-5566-6777-e888-99aabbccddee 27 12701234-5566-6777-e888-99aabbccddee 27 +12901234-5566-7777-8888-99aabbccddee 29 12901234-5566-7777-8888-99aabbccddee 29 +13101234-5566-7777-e888-99aabbccddee 31 13101234-5566-7777-e888-99aabbccddee 31 +13301234-5566-8777-8888-99aabbccddee 33 13301234-5566-8777-8888-99aabbccddee 33 +13501234-5566-8777-e888-99aabbccddee 35 13501234-5566-8777-e888-99aabbccddee 35 +13701234-5566-9777-8888-99aabbccddee 37 13701234-5566-9777-8888-99aabbccddee 37 +13901234-5566-9777-e888-99aabbccddee 39 13901234-5566-9777-e888-99aabbccddee 39 +14101234-5566-a777-8888-99aabbccddee 41 14101234-5566-a777-8888-99aabbccddee 41 +14301234-5566-a777-e888-99aabbccddee 43 14301234-5566-a777-e888-99aabbccddee 43 +14501234-5566-b777-8888-99aabbccddee 45 14501234-5566-b777-8888-99aabbccddee 45 +14701234-5566-b777-e888-99aabbccddee 47 14701234-5566-b777-e888-99aabbccddee 47 +14901234-5566-c777-8888-99aabbccddee 49 14901234-5566-c777-8888-99aabbccddee 49 +15101234-5566-c777-e888-99aabbccddee 51 15101234-5566-c777-e888-99aabbccddee 51 +15301234-5566-d777-8888-99aabbccddee 53 15301234-5566-d777-8888-99aabbccddee 53 +15501234-5566-d777-e888-99aabbccddee 55 15501234-5566-d777-e888-99aabbccddee 55 +15701234-5566-e777-8888-99aabbccddee 57 15701234-5566-e777-8888-99aabbccddee 57 +15901234-5566-e777-e888-99aabbccddee 59 15901234-5566-e777-e888-99aabbccddee 59 +16101234-5566-f777-8888-99aabbccddee 61 16101234-5566-f777-8888-99aabbccddee 61 +16301234-5566-f777-e888-99aabbccddee 63 16301234-5566-f777-e888-99aabbccddee 63 +NULL 32 NULL NULL +NULL 36 NULL NULL +NULL 40 NULL NULL +NULL 44 NULL NULL +NULL 48 NULL NULL +NULL 52 NULL NULL +NULL 56 NULL NULL +NULL 60 NULL NULL +explain select * from t1 left join t2 on (t1.a<=>t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 64 +1 SIMPLE t2 ref a a 17 test.t1.a 1 Using where +select * from t1 left join t2 on (t1.a<=>t2.a); +a b a b +00001234-5566-0777-0888-99aabbccddee 0 00001234-5566-0777-0888-99aabbccddee 0 +00201234-5566-0777-c888-99aabbccddee 2 00201234-5566-0777-c888-99aabbccddee 2 +00401234-5566-1777-0888-99aabbccddee 4 00401234-5566-1777-0888-99aabbccddee 4 +00601234-5566-1777-c888-99aabbccddee 6 00601234-5566-1777-c888-99aabbccddee 6 +00801234-5566-2777-0888-99aabbccddee 8 00801234-5566-2777-0888-99aabbccddee 8 +01001234-5566-2777-c888-99aabbccddee 10 01001234-5566-2777-c888-99aabbccddee 10 +01201234-5566-3777-0888-99aabbccddee 12 01201234-5566-3777-0888-99aabbccddee 12 +01401234-5566-3777-c888-99aabbccddee 14 01401234-5566-3777-c888-99aabbccddee 14 +01601234-5566-4777-0888-99aabbccddee 16 01601234-5566-4777-0888-99aabbccddee 16 +01801234-5566-4777-c888-99aabbccddee 18 01801234-5566-4777-c888-99aabbccddee 18 +02001234-5566-5777-0888-99aabbccddee 20 02001234-5566-5777-0888-99aabbccddee 20 +02201234-5566-5777-c888-99aabbccddee 22 02201234-5566-5777-c888-99aabbccddee 22 +02401234-5566-6777-0888-99aabbccddee 24 02401234-5566-6777-0888-99aabbccddee 24 +02601234-5566-6777-c888-99aabbccddee 26 02601234-5566-6777-c888-99aabbccddee 26 +02801234-5566-7777-0888-99aabbccddee 28 02801234-5566-7777-0888-99aabbccddee 28 +03001234-5566-7777-c888-99aabbccddee 30 03001234-5566-7777-c888-99aabbccddee 30 +03401234-5566-8777-c888-99aabbccddee 34 03401234-5566-8777-c888-99aabbccddee 34 +03801234-5566-9777-c888-99aabbccddee 38 03801234-5566-9777-c888-99aabbccddee 38 +04201234-5566-a777-c888-99aabbccddee 42 04201234-5566-a777-c888-99aabbccddee 42 +04601234-5566-b777-c888-99aabbccddee 46 04601234-5566-b777-c888-99aabbccddee 46 +05001234-5566-c777-c888-99aabbccddee 50 05001234-5566-c777-c888-99aabbccddee 50 +05401234-5566-d777-c888-99aabbccddee 54 05401234-5566-d777-c888-99aabbccddee 54 +05801234-5566-e777-c888-99aabbccddee 58 05801234-5566-e777-c888-99aabbccddee 58 +06201234-5566-f777-c888-99aabbccddee 62 06201234-5566-f777-c888-99aabbccddee 62 +10101234-5566-0777-8888-99aabbccddee 1 10101234-5566-0777-8888-99aabbccddee 1 +10301234-5566-0777-e888-99aabbccddee 3 10301234-5566-0777-e888-99aabbccddee 3 +10501234-5566-1777-8888-99aabbccddee 5 10501234-5566-1777-8888-99aabbccddee 5 +10701234-5566-1777-e888-99aabbccddee 7 10701234-5566-1777-e888-99aabbccddee 7 +10901234-5566-2777-8888-99aabbccddee 9 10901234-5566-2777-8888-99aabbccddee 9 +11101234-5566-2777-e888-99aabbccddee 11 11101234-5566-2777-e888-99aabbccddee 11 +11301234-5566-3777-8888-99aabbccddee 13 11301234-5566-3777-8888-99aabbccddee 13 +11501234-5566-3777-e888-99aabbccddee 15 11501234-5566-3777-e888-99aabbccddee 15 +11701234-5566-4777-8888-99aabbccddee 17 11701234-5566-4777-8888-99aabbccddee 17 +11901234-5566-4777-e888-99aabbccddee 19 11901234-5566-4777-e888-99aabbccddee 19 +12101234-5566-5777-8888-99aabbccddee 21 12101234-5566-5777-8888-99aabbccddee 21 +12301234-5566-5777-e888-99aabbccddee 23 12301234-5566-5777-e888-99aabbccddee 23 +12501234-5566-6777-8888-99aabbccddee 25 12501234-5566-6777-8888-99aabbccddee 25 +12701234-5566-6777-e888-99aabbccddee 27 12701234-5566-6777-e888-99aabbccddee 27 +12901234-5566-7777-8888-99aabbccddee 29 12901234-5566-7777-8888-99aabbccddee 29 +13101234-5566-7777-e888-99aabbccddee 31 13101234-5566-7777-e888-99aabbccddee 31 +13301234-5566-8777-8888-99aabbccddee 33 13301234-5566-8777-8888-99aabbccddee 33 +13501234-5566-8777-e888-99aabbccddee 35 13501234-5566-8777-e888-99aabbccddee 35 +13701234-5566-9777-8888-99aabbccddee 37 13701234-5566-9777-8888-99aabbccddee 37 +13901234-5566-9777-e888-99aabbccddee 39 13901234-5566-9777-e888-99aabbccddee 39 +14101234-5566-a777-8888-99aabbccddee 41 14101234-5566-a777-8888-99aabbccddee 41 +14301234-5566-a777-e888-99aabbccddee 43 14301234-5566-a777-e888-99aabbccddee 43 +14501234-5566-b777-8888-99aabbccddee 45 14501234-5566-b777-8888-99aabbccddee 45 +14701234-5566-b777-e888-99aabbccddee 47 14701234-5566-b777-e888-99aabbccddee 47 +14901234-5566-c777-8888-99aabbccddee 49 14901234-5566-c777-8888-99aabbccddee 49 +15101234-5566-c777-e888-99aabbccddee 51 15101234-5566-c777-e888-99aabbccddee 51 +15301234-5566-d777-8888-99aabbccddee 53 15301234-5566-d777-8888-99aabbccddee 53 +15501234-5566-d777-e888-99aabbccddee 55 15501234-5566-d777-e888-99aabbccddee 55 +15701234-5566-e777-8888-99aabbccddee 57 15701234-5566-e777-8888-99aabbccddee 57 +15901234-5566-e777-e888-99aabbccddee 59 15901234-5566-e777-e888-99aabbccddee 59 +16101234-5566-f777-8888-99aabbccddee 61 16101234-5566-f777-8888-99aabbccddee 61 +16301234-5566-f777-e888-99aabbccddee 63 16301234-5566-f777-e888-99aabbccddee 63 +NULL 32 NULL NULL +NULL 36 NULL NULL +NULL 40 NULL NULL +NULL 44 NULL NULL +NULL 48 NULL NULL +NULL 52 NULL NULL +NULL 56 NULL NULL +NULL 60 NULL NULL +explain select * from t2 left join t1 on (t1.a=t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 ref a a 17 test.t2.a 1 Using where +select * from t2 left join t1 on (t1.a=t2.a); +a b a b +00001234-5566-0777-0888-99aabbccddee 0 00001234-5566-0777-0888-99aabbccddee 0 +00201234-5566-0777-c888-99aabbccddee 2 00201234-5566-0777-c888-99aabbccddee 2 +00401234-5566-1777-0888-99aabbccddee 4 00401234-5566-1777-0888-99aabbccddee 4 +00601234-5566-1777-c888-99aabbccddee 6 00601234-5566-1777-c888-99aabbccddee 6 +00801234-5566-2777-0888-99aabbccddee 8 00801234-5566-2777-0888-99aabbccddee 8 +01001234-5566-2777-c888-99aabbccddee 10 01001234-5566-2777-c888-99aabbccddee 10 +01201234-5566-3777-0888-99aabbccddee 12 01201234-5566-3777-0888-99aabbccddee 12 +01401234-5566-3777-c888-99aabbccddee 14 01401234-5566-3777-c888-99aabbccddee 14 +01601234-5566-4777-0888-99aabbccddee 16 01601234-5566-4777-0888-99aabbccddee 16 +01801234-5566-4777-c888-99aabbccddee 18 01801234-5566-4777-c888-99aabbccddee 18 +02001234-5566-5777-0888-99aabbccddee 20 02001234-5566-5777-0888-99aabbccddee 20 +02201234-5566-5777-c888-99aabbccddee 22 02201234-5566-5777-c888-99aabbccddee 22 +02401234-5566-6777-0888-99aabbccddee 24 02401234-5566-6777-0888-99aabbccddee 24 +02601234-5566-6777-c888-99aabbccddee 26 02601234-5566-6777-c888-99aabbccddee 26 +02801234-5566-7777-0888-99aabbccddee 28 02801234-5566-7777-0888-99aabbccddee 28 +03001234-5566-7777-c888-99aabbccddee 30 03001234-5566-7777-c888-99aabbccddee 30 +03201234-5566-8777-0888-99aabbccddee 32 NULL NULL +03401234-5566-8777-c888-99aabbccddee 34 03401234-5566-8777-c888-99aabbccddee 34 +03601234-5566-9777-0888-99aabbccddee 36 NULL NULL +03801234-5566-9777-c888-99aabbccddee 38 03801234-5566-9777-c888-99aabbccddee 38 +04001234-5566-a777-0888-99aabbccddee 40 NULL NULL +04201234-5566-a777-c888-99aabbccddee 42 04201234-5566-a777-c888-99aabbccddee 42 +04401234-5566-b777-0888-99aabbccddee 44 NULL NULL +04601234-5566-b777-c888-99aabbccddee 46 04601234-5566-b777-c888-99aabbccddee 46 +04801234-5566-c777-0888-99aabbccddee 48 NULL NULL +05001234-5566-c777-c888-99aabbccddee 50 05001234-5566-c777-c888-99aabbccddee 50 +05201234-5566-d777-0888-99aabbccddee 52 NULL NULL +05401234-5566-d777-c888-99aabbccddee 54 05401234-5566-d777-c888-99aabbccddee 54 +05601234-5566-e777-0888-99aabbccddee 56 NULL NULL +05801234-5566-e777-c888-99aabbccddee 58 05801234-5566-e777-c888-99aabbccddee 58 +06001234-5566-f777-0888-99aabbccddee 60 NULL NULL +06201234-5566-f777-c888-99aabbccddee 62 06201234-5566-f777-c888-99aabbccddee 62 +10101234-5566-0777-8888-99aabbccddee 1 10101234-5566-0777-8888-99aabbccddee 1 +10301234-5566-0777-e888-99aabbccddee 3 10301234-5566-0777-e888-99aabbccddee 3 +10501234-5566-1777-8888-99aabbccddee 5 10501234-5566-1777-8888-99aabbccddee 5 +10701234-5566-1777-e888-99aabbccddee 7 10701234-5566-1777-e888-99aabbccddee 7 +10901234-5566-2777-8888-99aabbccddee 9 10901234-5566-2777-8888-99aabbccddee 9 +11101234-5566-2777-e888-99aabbccddee 11 11101234-5566-2777-e888-99aabbccddee 11 +11301234-5566-3777-8888-99aabbccddee 13 11301234-5566-3777-8888-99aabbccddee 13 +11501234-5566-3777-e888-99aabbccddee 15 11501234-5566-3777-e888-99aabbccddee 15 +11701234-5566-4777-8888-99aabbccddee 17 11701234-5566-4777-8888-99aabbccddee 17 +11901234-5566-4777-e888-99aabbccddee 19 11901234-5566-4777-e888-99aabbccddee 19 +12101234-5566-5777-8888-99aabbccddee 21 12101234-5566-5777-8888-99aabbccddee 21 +12301234-5566-5777-e888-99aabbccddee 23 12301234-5566-5777-e888-99aabbccddee 23 +12501234-5566-6777-8888-99aabbccddee 25 12501234-5566-6777-8888-99aabbccddee 25 +12701234-5566-6777-e888-99aabbccddee 27 12701234-5566-6777-e888-99aabbccddee 27 +12901234-5566-7777-8888-99aabbccddee 29 12901234-5566-7777-8888-99aabbccddee 29 +13101234-5566-7777-e888-99aabbccddee 31 13101234-5566-7777-e888-99aabbccddee 31 +13301234-5566-8777-8888-99aabbccddee 33 13301234-5566-8777-8888-99aabbccddee 33 +13501234-5566-8777-e888-99aabbccddee 35 13501234-5566-8777-e888-99aabbccddee 35 +13701234-5566-9777-8888-99aabbccddee 37 13701234-5566-9777-8888-99aabbccddee 37 +13901234-5566-9777-e888-99aabbccddee 39 13901234-5566-9777-e888-99aabbccddee 39 +14101234-5566-a777-8888-99aabbccddee 41 14101234-5566-a777-8888-99aabbccddee 41 +14301234-5566-a777-e888-99aabbccddee 43 14301234-5566-a777-e888-99aabbccddee 43 +14501234-5566-b777-8888-99aabbccddee 45 14501234-5566-b777-8888-99aabbccddee 45 +14701234-5566-b777-e888-99aabbccddee 47 14701234-5566-b777-e888-99aabbccddee 47 +14901234-5566-c777-8888-99aabbccddee 49 14901234-5566-c777-8888-99aabbccddee 49 +15101234-5566-c777-e888-99aabbccddee 51 15101234-5566-c777-e888-99aabbccddee 51 +15301234-5566-d777-8888-99aabbccddee 53 15301234-5566-d777-8888-99aabbccddee 53 +15501234-5566-d777-e888-99aabbccddee 55 15501234-5566-d777-e888-99aabbccddee 55 +15701234-5566-e777-8888-99aabbccddee 57 15701234-5566-e777-8888-99aabbccddee 57 +15901234-5566-e777-e888-99aabbccddee 59 15901234-5566-e777-e888-99aabbccddee 59 +16101234-5566-f777-8888-99aabbccddee 61 16101234-5566-f777-8888-99aabbccddee 61 +16301234-5566-f777-e888-99aabbccddee 63 16301234-5566-f777-e888-99aabbccddee 63 +explain select * from t2 left join t1 on (t1.a<=>t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 ref a a 17 test.t2.a 1 Using where +select * from t2 left join t1 on (t1.a<=>t2.a); +a b a b +00001234-5566-0777-0888-99aabbccddee 0 00001234-5566-0777-0888-99aabbccddee 0 +00201234-5566-0777-c888-99aabbccddee 2 00201234-5566-0777-c888-99aabbccddee 2 +00401234-5566-1777-0888-99aabbccddee 4 00401234-5566-1777-0888-99aabbccddee 4 +00601234-5566-1777-c888-99aabbccddee 6 00601234-5566-1777-c888-99aabbccddee 6 +00801234-5566-2777-0888-99aabbccddee 8 00801234-5566-2777-0888-99aabbccddee 8 +01001234-5566-2777-c888-99aabbccddee 10 01001234-5566-2777-c888-99aabbccddee 10 +01201234-5566-3777-0888-99aabbccddee 12 01201234-5566-3777-0888-99aabbccddee 12 +01401234-5566-3777-c888-99aabbccddee 14 01401234-5566-3777-c888-99aabbccddee 14 +01601234-5566-4777-0888-99aabbccddee 16 01601234-5566-4777-0888-99aabbccddee 16 +01801234-5566-4777-c888-99aabbccddee 18 01801234-5566-4777-c888-99aabbccddee 18 +02001234-5566-5777-0888-99aabbccddee 20 02001234-5566-5777-0888-99aabbccddee 20 +02201234-5566-5777-c888-99aabbccddee 22 02201234-5566-5777-c888-99aabbccddee 22 +02401234-5566-6777-0888-99aabbccddee 24 02401234-5566-6777-0888-99aabbccddee 24 +02601234-5566-6777-c888-99aabbccddee 26 02601234-5566-6777-c888-99aabbccddee 26 +02801234-5566-7777-0888-99aabbccddee 28 02801234-5566-7777-0888-99aabbccddee 28 +03001234-5566-7777-c888-99aabbccddee 30 03001234-5566-7777-c888-99aabbccddee 30 +03201234-5566-8777-0888-99aabbccddee 32 NULL 32 +03201234-5566-8777-0888-99aabbccddee 32 NULL 36 +03201234-5566-8777-0888-99aabbccddee 32 NULL 40 +03201234-5566-8777-0888-99aabbccddee 32 NULL 44 +03201234-5566-8777-0888-99aabbccddee 32 NULL 48 +03201234-5566-8777-0888-99aabbccddee 32 NULL 52 +03201234-5566-8777-0888-99aabbccddee 32 NULL 56 +03201234-5566-8777-0888-99aabbccddee 32 NULL 60 +03401234-5566-8777-c888-99aabbccddee 34 03401234-5566-8777-c888-99aabbccddee 34 +03601234-5566-9777-0888-99aabbccddee 36 NULL 32 +03601234-5566-9777-0888-99aabbccddee 36 NULL 36 +03601234-5566-9777-0888-99aabbccddee 36 NULL 40 +03601234-5566-9777-0888-99aabbccddee 36 NULL 44 +03601234-5566-9777-0888-99aabbccddee 36 NULL 48 +03601234-5566-9777-0888-99aabbccddee 36 NULL 52 +03601234-5566-9777-0888-99aabbccddee 36 NULL 56 +03601234-5566-9777-0888-99aabbccddee 36 NULL 60 +03801234-5566-9777-c888-99aabbccddee 38 03801234-5566-9777-c888-99aabbccddee 38 +04001234-5566-a777-0888-99aabbccddee 40 NULL 32 +04001234-5566-a777-0888-99aabbccddee 40 NULL 36 +04001234-5566-a777-0888-99aabbccddee 40 NULL 40 +04001234-5566-a777-0888-99aabbccddee 40 NULL 44 +04001234-5566-a777-0888-99aabbccddee 40 NULL 48 +04001234-5566-a777-0888-99aabbccddee 40 NULL 52 +04001234-5566-a777-0888-99aabbccddee 40 NULL 56 +04001234-5566-a777-0888-99aabbccddee 40 NULL 60 +04201234-5566-a777-c888-99aabbccddee 42 04201234-5566-a777-c888-99aabbccddee 42 +04401234-5566-b777-0888-99aabbccddee 44 NULL 32 +04401234-5566-b777-0888-99aabbccddee 44 NULL 36 +04401234-5566-b777-0888-99aabbccddee 44 NULL 40 +04401234-5566-b777-0888-99aabbccddee 44 NULL 44 +04401234-5566-b777-0888-99aabbccddee 44 NULL 48 +04401234-5566-b777-0888-99aabbccddee 44 NULL 52 +04401234-5566-b777-0888-99aabbccddee 44 NULL 56 +04401234-5566-b777-0888-99aabbccddee 44 NULL 60 +04601234-5566-b777-c888-99aabbccddee 46 04601234-5566-b777-c888-99aabbccddee 46 +04801234-5566-c777-0888-99aabbccddee 48 NULL 32 +04801234-5566-c777-0888-99aabbccddee 48 NULL 36 +04801234-5566-c777-0888-99aabbccddee 48 NULL 40 +04801234-5566-c777-0888-99aabbccddee 48 NULL 44 +04801234-5566-c777-0888-99aabbccddee 48 NULL 48 +04801234-5566-c777-0888-99aabbccddee 48 NULL 52 +04801234-5566-c777-0888-99aabbccddee 48 NULL 56 +04801234-5566-c777-0888-99aabbccddee 48 NULL 60 +05001234-5566-c777-c888-99aabbccddee 50 05001234-5566-c777-c888-99aabbccddee 50 +05201234-5566-d777-0888-99aabbccddee 52 NULL 32 +05201234-5566-d777-0888-99aabbccddee 52 NULL 36 +05201234-5566-d777-0888-99aabbccddee 52 NULL 40 +05201234-5566-d777-0888-99aabbccddee 52 NULL 44 +05201234-5566-d777-0888-99aabbccddee 52 NULL 48 +05201234-5566-d777-0888-99aabbccddee 52 NULL 52 +05201234-5566-d777-0888-99aabbccddee 52 NULL 56 +05201234-5566-d777-0888-99aabbccddee 52 NULL 60 +05401234-5566-d777-c888-99aabbccddee 54 05401234-5566-d777-c888-99aabbccddee 54 +05601234-5566-e777-0888-99aabbccddee 56 NULL 32 +05601234-5566-e777-0888-99aabbccddee 56 NULL 36 +05601234-5566-e777-0888-99aabbccddee 56 NULL 40 +05601234-5566-e777-0888-99aabbccddee 56 NULL 44 +05601234-5566-e777-0888-99aabbccddee 56 NULL 48 +05601234-5566-e777-0888-99aabbccddee 56 NULL 52 +05601234-5566-e777-0888-99aabbccddee 56 NULL 56 +05601234-5566-e777-0888-99aabbccddee 56 NULL 60 +05801234-5566-e777-c888-99aabbccddee 58 05801234-5566-e777-c888-99aabbccddee 58 +06001234-5566-f777-0888-99aabbccddee 60 NULL 32 +06001234-5566-f777-0888-99aabbccddee 60 NULL 36 +06001234-5566-f777-0888-99aabbccddee 60 NULL 40 +06001234-5566-f777-0888-99aabbccddee 60 NULL 44 +06001234-5566-f777-0888-99aabbccddee 60 NULL 48 +06001234-5566-f777-0888-99aabbccddee 60 NULL 52 +06001234-5566-f777-0888-99aabbccddee 60 NULL 56 +06001234-5566-f777-0888-99aabbccddee 60 NULL 60 +06201234-5566-f777-c888-99aabbccddee 62 06201234-5566-f777-c888-99aabbccddee 62 +10101234-5566-0777-8888-99aabbccddee 1 10101234-5566-0777-8888-99aabbccddee 1 +10301234-5566-0777-e888-99aabbccddee 3 10301234-5566-0777-e888-99aabbccddee 3 +10501234-5566-1777-8888-99aabbccddee 5 10501234-5566-1777-8888-99aabbccddee 5 +10701234-5566-1777-e888-99aabbccddee 7 10701234-5566-1777-e888-99aabbccddee 7 +10901234-5566-2777-8888-99aabbccddee 9 10901234-5566-2777-8888-99aabbccddee 9 +11101234-5566-2777-e888-99aabbccddee 11 11101234-5566-2777-e888-99aabbccddee 11 +11301234-5566-3777-8888-99aabbccddee 13 11301234-5566-3777-8888-99aabbccddee 13 +11501234-5566-3777-e888-99aabbccddee 15 11501234-5566-3777-e888-99aabbccddee 15 +11701234-5566-4777-8888-99aabbccddee 17 11701234-5566-4777-8888-99aabbccddee 17 +11901234-5566-4777-e888-99aabbccddee 19 11901234-5566-4777-e888-99aabbccddee 19 +12101234-5566-5777-8888-99aabbccddee 21 12101234-5566-5777-8888-99aabbccddee 21 +12301234-5566-5777-e888-99aabbccddee 23 12301234-5566-5777-e888-99aabbccddee 23 +12501234-5566-6777-8888-99aabbccddee 25 12501234-5566-6777-8888-99aabbccddee 25 +12701234-5566-6777-e888-99aabbccddee 27 12701234-5566-6777-e888-99aabbccddee 27 +12901234-5566-7777-8888-99aabbccddee 29 12901234-5566-7777-8888-99aabbccddee 29 +13101234-5566-7777-e888-99aabbccddee 31 13101234-5566-7777-e888-99aabbccddee 31 +13301234-5566-8777-8888-99aabbccddee 33 13301234-5566-8777-8888-99aabbccddee 33 +13501234-5566-8777-e888-99aabbccddee 35 13501234-5566-8777-e888-99aabbccddee 35 +13701234-5566-9777-8888-99aabbccddee 37 13701234-5566-9777-8888-99aabbccddee 37 +13901234-5566-9777-e888-99aabbccddee 39 13901234-5566-9777-e888-99aabbccddee 39 +14101234-5566-a777-8888-99aabbccddee 41 14101234-5566-a777-8888-99aabbccddee 41 +14301234-5566-a777-e888-99aabbccddee 43 14301234-5566-a777-e888-99aabbccddee 43 +14501234-5566-b777-8888-99aabbccddee 45 14501234-5566-b777-8888-99aabbccddee 45 +14701234-5566-b777-e888-99aabbccddee 47 14701234-5566-b777-e888-99aabbccddee 47 +14901234-5566-c777-8888-99aabbccddee 49 14901234-5566-c777-8888-99aabbccddee 49 +15101234-5566-c777-e888-99aabbccddee 51 15101234-5566-c777-e888-99aabbccddee 51 +15301234-5566-d777-8888-99aabbccddee 53 15301234-5566-d777-8888-99aabbccddee 53 +15501234-5566-d777-e888-99aabbccddee 55 15501234-5566-d777-e888-99aabbccddee 55 +15701234-5566-e777-8888-99aabbccddee 57 15701234-5566-e777-8888-99aabbccddee 57 +15901234-5566-e777-e888-99aabbccddee 59 15901234-5566-e777-e888-99aabbccddee 59 +16101234-5566-f777-8888-99aabbccddee 61 16101234-5566-f777-8888-99aabbccddee 61 +16301234-5566-f777-e888-99aabbccddee 63 16301234-5566-f777-e888-99aabbccddee 63 +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '06001234-5566-f777-0888-99aabbccddee' +Warnings: +select * from t1 union select * from t2; +a b +00001234-5566-0777-0888-99aabbccddee 0 +00201234-5566-0777-c888-99aabbccddee 2 +00401234-5566-1777-0888-99aabbccddee 4 +00601234-5566-1777-c888-99aabbccddee 6 +00801234-5566-2777-0888-99aabbccddee 8 +01001234-5566-2777-c888-99aabbccddee 10 +01201234-5566-3777-0888-99aabbccddee 12 +01401234-5566-3777-c888-99aabbccddee 14 +01601234-5566-4777-0888-99aabbccddee 16 +01801234-5566-4777-c888-99aabbccddee 18 +02001234-5566-5777-0888-99aabbccddee 20 +02201234-5566-5777-c888-99aabbccddee 22 +02401234-5566-6777-0888-99aabbccddee 24 +02601234-5566-6777-c888-99aabbccddee 26 +02801234-5566-7777-0888-99aabbccddee 28 +03001234-5566-7777-c888-99aabbccddee 30 +03401234-5566-8777-c888-99aabbccddee 34 +03801234-5566-9777-c888-99aabbccddee 38 +04201234-5566-a777-c888-99aabbccddee 42 +04601234-5566-b777-c888-99aabbccddee 46 +05001234-5566-c777-c888-99aabbccddee 50 +05401234-5566-d777-c888-99aabbccddee 54 +05801234-5566-e777-c888-99aabbccddee 58 +06201234-5566-f777-c888-99aabbccddee 62 +10101234-5566-0777-8888-99aabbccddee 1 +10301234-5566-0777-e888-99aabbccddee 3 +10501234-5566-1777-8888-99aabbccddee 5 +10701234-5566-1777-e888-99aabbccddee 7 +10901234-5566-2777-8888-99aabbccddee 9 +11101234-5566-2777-e888-99aabbccddee 11 +11301234-5566-3777-8888-99aabbccddee 13 +11501234-5566-3777-e888-99aabbccddee 15 +11701234-5566-4777-8888-99aabbccddee 17 +11901234-5566-4777-e888-99aabbccddee 19 +12101234-5566-5777-8888-99aabbccddee 21 +12301234-5566-5777-e888-99aabbccddee 23 +12501234-5566-6777-8888-99aabbccddee 25 +12701234-5566-6777-e888-99aabbccddee 27 +12901234-5566-7777-8888-99aabbccddee 29 +13101234-5566-7777-e888-99aabbccddee 31 +13301234-5566-8777-8888-99aabbccddee 33 +13501234-5566-8777-e888-99aabbccddee 35 +13701234-5566-9777-8888-99aabbccddee 37 +13901234-5566-9777-e888-99aabbccddee 39 +14101234-5566-a777-8888-99aabbccddee 41 +14301234-5566-a777-e888-99aabbccddee 43 +14501234-5566-b777-8888-99aabbccddee 45 +14701234-5566-b777-e888-99aabbccddee 47 +14901234-5566-c777-8888-99aabbccddee 49 +15101234-5566-c777-e888-99aabbccddee 51 +15301234-5566-d777-8888-99aabbccddee 53 +15501234-5566-d777-e888-99aabbccddee 55 +15701234-5566-e777-8888-99aabbccddee 57 +15901234-5566-e777-e888-99aabbccddee 59 +16101234-5566-f777-8888-99aabbccddee 61 +16301234-5566-f777-e888-99aabbccddee 63 +NULL 32 +NULL 36 +NULL 40 +NULL 44 +NULL 48 +NULL 52 +NULL 56 +NULL 60 +select * from t1, t1 t where t1.b div 4 in (6,7) and t.b div 4 in (6,7) and t1.a > t.a; +a b a b +02601234-5566-6777-c888-99aabbccddee 26 02401234-5566-6777-0888-99aabbccddee 24 +02801234-5566-7777-0888-99aabbccddee 28 02401234-5566-6777-0888-99aabbccddee 24 +02801234-5566-7777-0888-99aabbccddee 28 02601234-5566-6777-c888-99aabbccddee 26 +03001234-5566-7777-c888-99aabbccddee 30 02401234-5566-6777-0888-99aabbccddee 24 +03001234-5566-7777-c888-99aabbccddee 30 02601234-5566-6777-c888-99aabbccddee 26 +03001234-5566-7777-c888-99aabbccddee 30 02801234-5566-7777-0888-99aabbccddee 28 +12501234-5566-6777-8888-99aabbccddee 25 02401234-5566-6777-0888-99aabbccddee 24 +12501234-5566-6777-8888-99aabbccddee 25 02601234-5566-6777-c888-99aabbccddee 26 +12501234-5566-6777-8888-99aabbccddee 25 02801234-5566-7777-0888-99aabbccddee 28 +12501234-5566-6777-8888-99aabbccddee 25 03001234-5566-7777-c888-99aabbccddee 30 +12701234-5566-6777-e888-99aabbccddee 27 02401234-5566-6777-0888-99aabbccddee 24 +12701234-5566-6777-e888-99aabbccddee 27 02601234-5566-6777-c888-99aabbccddee 26 +12701234-5566-6777-e888-99aabbccddee 27 02801234-5566-7777-0888-99aabbccddee 28 +12701234-5566-6777-e888-99aabbccddee 27 03001234-5566-7777-c888-99aabbccddee 30 +12701234-5566-6777-e888-99aabbccddee 27 12501234-5566-6777-8888-99aabbccddee 25 +12901234-5566-7777-8888-99aabbccddee 29 02401234-5566-6777-0888-99aabbccddee 24 +12901234-5566-7777-8888-99aabbccddee 29 02601234-5566-6777-c888-99aabbccddee 26 +12901234-5566-7777-8888-99aabbccddee 29 02801234-5566-7777-0888-99aabbccddee 28 +12901234-5566-7777-8888-99aabbccddee 29 03001234-5566-7777-c888-99aabbccddee 30 +12901234-5566-7777-8888-99aabbccddee 29 12501234-5566-6777-8888-99aabbccddee 25 +12901234-5566-7777-8888-99aabbccddee 29 12701234-5566-6777-e888-99aabbccddee 27 +13101234-5566-7777-e888-99aabbccddee 31 02401234-5566-6777-0888-99aabbccddee 24 +13101234-5566-7777-e888-99aabbccddee 31 02601234-5566-6777-c888-99aabbccddee 26 +13101234-5566-7777-e888-99aabbccddee 31 02801234-5566-7777-0888-99aabbccddee 28 +13101234-5566-7777-e888-99aabbccddee 31 03001234-5566-7777-c888-99aabbccddee 30 +13101234-5566-7777-e888-99aabbccddee 31 12501234-5566-6777-8888-99aabbccddee 25 +13101234-5566-7777-e888-99aabbccddee 31 12701234-5566-6777-e888-99aabbccddee 27 +13101234-5566-7777-e888-99aabbccddee 31 12901234-5566-7777-8888-99aabbccddee 29 +alter ignore table t2 force; +Warnings: +Warning 1292 Incorrect uuid value: '03201234-5566-8777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 33 +Warning 1292 Incorrect uuid value: '03601234-5566-9777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 37 +Warning 1292 Incorrect uuid value: '04001234-5566-a777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 41 +Warning 1292 Incorrect uuid value: '04401234-5566-b777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 45 +Warning 1292 Incorrect uuid value: '04801234-5566-c777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 49 +Warning 1292 Incorrect uuid value: '05201234-5566-d777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 53 +Warning 1292 Incorrect uuid value: '05601234-5566-e777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 57 +Warning 1292 Incorrect uuid value: '06001234-5566-f777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 61 +drop table t2; +# +# MDEV-31926 UUID v7 are compared incorrectly +# +select * from t1, t1 t where t1.b div 4 in (6,7) and t.b div 4 in (6,7) and concat(t1.a) > concat(t.a); +a b a b +02601234-5566-6777-c888-99aabbccddee 26 02401234-5566-6777-0888-99aabbccddee 24 +02801234-5566-7777-0888-99aabbccddee 28 02401234-5566-6777-0888-99aabbccddee 24 +02801234-5566-7777-0888-99aabbccddee 28 02601234-5566-6777-c888-99aabbccddee 26 +03001234-5566-7777-c888-99aabbccddee 30 02401234-5566-6777-0888-99aabbccddee 24 +03001234-5566-7777-c888-99aabbccddee 30 02601234-5566-6777-c888-99aabbccddee 26 +03001234-5566-7777-c888-99aabbccddee 30 02801234-5566-7777-0888-99aabbccddee 28 +12501234-5566-6777-8888-99aabbccddee 25 02401234-5566-6777-0888-99aabbccddee 24 +12501234-5566-6777-8888-99aabbccddee 25 02601234-5566-6777-c888-99aabbccddee 26 +12501234-5566-6777-8888-99aabbccddee 25 02801234-5566-7777-0888-99aabbccddee 28 +12501234-5566-6777-8888-99aabbccddee 25 03001234-5566-7777-c888-99aabbccddee 30 +12701234-5566-6777-e888-99aabbccddee 27 02401234-5566-6777-0888-99aabbccddee 24 +12701234-5566-6777-e888-99aabbccddee 27 02601234-5566-6777-c888-99aabbccddee 26 +12701234-5566-6777-e888-99aabbccddee 27 02801234-5566-7777-0888-99aabbccddee 28 +12701234-5566-6777-e888-99aabbccddee 27 03001234-5566-7777-c888-99aabbccddee 30 +12701234-5566-6777-e888-99aabbccddee 27 12501234-5566-6777-8888-99aabbccddee 25 +12901234-5566-7777-8888-99aabbccddee 29 02401234-5566-6777-0888-99aabbccddee 24 +12901234-5566-7777-8888-99aabbccddee 29 02601234-5566-6777-c888-99aabbccddee 26 +12901234-5566-7777-8888-99aabbccddee 29 02801234-5566-7777-0888-99aabbccddee 28 +12901234-5566-7777-8888-99aabbccddee 29 03001234-5566-7777-c888-99aabbccddee 30 +12901234-5566-7777-8888-99aabbccddee 29 12501234-5566-6777-8888-99aabbccddee 25 +12901234-5566-7777-8888-99aabbccddee 29 12701234-5566-6777-e888-99aabbccddee 27 +13101234-5566-7777-e888-99aabbccddee 31 02401234-5566-6777-0888-99aabbccddee 24 +13101234-5566-7777-e888-99aabbccddee 31 02601234-5566-6777-c888-99aabbccddee 26 +13101234-5566-7777-e888-99aabbccddee 31 02801234-5566-7777-0888-99aabbccddee 28 +13101234-5566-7777-e888-99aabbccddee 31 03001234-5566-7777-c888-99aabbccddee 30 +13101234-5566-7777-e888-99aabbccddee 31 12501234-5566-6777-8888-99aabbccddee 25 +13101234-5566-7777-e888-99aabbccddee 31 12701234-5566-6777-e888-99aabbccddee 27 +13101234-5566-7777-e888-99aabbccddee 31 12901234-5566-7777-8888-99aabbccddee 29 +drop table t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/order.test b/plugin/type_uuid/mysql-test/type_uuid/order.test new file mode 100644 index 00000000..18854e85 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/order.test @@ -0,0 +1,62 @@ +# try all combinations of version and variant +source include/have_sequence.inc; + +create table t1 (a uuid, b int not null, index (a)); +insert t1 select sformat('{:03}01234-5566-{:x}777-{}888-99aabbccddee', + (seq % 2)*100 + seq, seq div 4, elt(1+(seq % 4),0,8,'c','e')),seq from seq_0_to_63; +select * from t1 order by b; +select * from t1 order by a; +show create table t1; + +--echo # now let's use the table as above, but created in 10.11.4 +let $datadir= `select @@datadir`; +--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.frm $datadir/test/t2.frm +--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.MYI $datadir/test/t2.MYI +--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.MYD $datadir/test/t2.MYD +select * from t2 order by b; +select * from t2 order by a; +show create table t2; + +explain select * from t1 left join t2 on (t1.a=t2.a); +--sorted_result +select * from t1 left join t2 on (t1.a=t2.a); + +explain select * from t1 left join t2 on (t1.a<=>t2.a); +--sorted_result +select * from t1 left join t2 on (t1.a<=>t2.a); + +explain select * from t2 left join t1 on (t1.a=t2.a); +--sorted_result +select * from t2 left join t1 on (t1.a=t2.a); + +explain select * from t2 left join t1 on (t1.a<=>t2.a); +--sorted_result +select * from t2 left join t1 on (t1.a<=>t2.a); + +--sorted_result +select * from t1 union select * from t2; + +--sorted_result +select * from t1, t1 t where t1.b div 4 in (6,7) and t.b div 4 in (6,7) and t1.a > t.a; + +alter ignore table t2 force; + +drop table t2; + +--echo # +--echo # MDEV-31926 UUID v7 are compared incorrectly +--echo # + +# for v6 and v7 string comparison should produce the same result. +# Quoting the standard draft: +# +# 6.11. Sorting +# +# UUIDv6 and UUIDv7 are designed so that implementations that require +# sorting (e.g., database indexes) sort as opaque raw bytes, without +# need for parsing or introspection. +# +--sorted_result +select * from t1, t1 t where t1.b div 4 in (6,7) and t.b div 4 in (6,7) and concat(t1.a) > concat(t.a); + +drop table t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.result new file mode 100644 index 00000000..553c8c6e --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.result @@ -0,0 +1,35 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.5 tests +# +# +# MDEV-4958 Adding datatype UUID +# +CREATE TABLE t1 (a BINARY(16)); +connection slave; +ALTER TABLE t1 MODIFY a UUID; +connection master; +INSERT INTO t1 VALUES (X'00000000000000000000000000000000'); +INSERT INTO t1 VALUES (X'00000000000000000000000000000001'); +INSERT INTO t1 VALUES (X'fffffffffffffffffffffffffffffffe'); +INSERT INTO t1 VALUES (X'ffffffffffffffffffffffffffffffff'); +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +00000000000000000000000000000000 +00000000000000000000000000000001 +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +connection slave; +SELECT * FROM t1 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +ffffffff-ffff-ffff-ffff-fffffffffffe +ffffffff-ffff-ffff-ffff-ffffffffffff +connection master; +DROP TABLE t1; +# +# End of 10.5 tests +# +include/rpl_end.inc diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.test new file mode 100644 index 00000000..6f3f5cae --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_binary_to_uuid.test @@ -0,0 +1,33 @@ +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +CREATE TABLE t1 (a BINARY(16)); + +--sync_slave_with_master +ALTER TABLE t1 MODIFY a UUID; + +--connection master +INSERT INTO t1 VALUES (X'00000000000000000000000000000000'); +INSERT INTO t1 VALUES (X'00000000000000000000000000000001'); +INSERT INTO t1 VALUES (X'fffffffffffffffffffffffffffffffe'); +INSERT INTO t1 VALUES (X'ffffffffffffffffffffffffffffffff'); +SELECT HEX(a) FROM t1 ORDER BY a; +--sync_slave_with_master +SELECT * FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +--source include/rpl_end.inc diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.result b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.result new file mode 100644 index 00000000..a917a683 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.result @@ -0,0 +1,35 @@ +include/master-slave.inc +[connection master] +# +# Start of 10.5 tests +# +# +# MDEV-4958 Adding datatype UUID +# +CREATE TABLE t1 (a UUID); +connection slave; +ALTER TABLE t1 MODIFY a BINARY(16); +connection master; +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe'); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); +SELECT a FROM t1 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +ffffffff-ffff-ffff-ffff-fffffffffffe +ffffffff-ffff-ffff-ffff-ffffffffffff +connection slave; +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +00000000000000000000000000000000 +00000000000000000000000000000001 +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +connection master; +DROP TABLE t1; +# +# End of 10.5 tests +# +include/rpl_end.inc diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.test b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.test new file mode 100644 index 00000000..df927faf --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_row_uuid_to_binary.test @@ -0,0 +1,33 @@ +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +CREATE TABLE t1 (a UUID); + +--sync_slave_with_master +ALTER TABLE t1 MODIFY a BINARY(16); + +--connection master +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe'); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); +SELECT a FROM t1 ORDER BY a; +--sync_slave_with_master +SELECT HEX(a) FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +--source include/rpl_end.inc diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.result new file mode 100644 index 00000000..c3825570 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.result @@ -0,0 +1,19 @@ +include/master-slave.inc +[connection master] +# +# MDEV-4958 Adding datatype UUID +# +connection master; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('ffffffff-ffff-ffff-ffff-ffffffffffff'); +connection slave; +SELECT HEX(a), a FROM t1; +HEX(a) a +00000000000000000000000000000000 00000000-0000-0000-0000-000000000000 +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ffffffff-ffff-ffff-ffff-ffffffffffff +connection master; +DROP TABLE t1; +connection slave; +include/rpl_end.inc diff --git a/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.test new file mode 100644 index 00000000..7651a0d5 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/rpl_type_uuid.test @@ -0,0 +1,18 @@ +--source include/master-slave.inc + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +connection master; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('ffffffff-ffff-ffff-ffff-ffffffffffff'); +sync_slave_with_master; +SELECT HEX(a), a FROM t1; +connection master; +DROP TABLE t1; +sync_slave_with_master; + +--source include/rpl_end.inc diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYD b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYD Binary files differnew file mode 100644 index 00000000..1e059467 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYD diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYI b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYI Binary files differnew file mode 100644 index 00000000..b85c5d61 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYI diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.frm b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.frm Binary files differnew file mode 100644 index 00000000..ebefe982 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.frm diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm Binary files differnew file mode 100644 index 00000000..ca934198 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1nopackkey.frm diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm Binary files differnew file mode 100644 index 00000000..b3d8e433 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/std_data/t1packkey.frm diff --git a/plugin/type_uuid/mysql-test/type_uuid/suite.pm b/plugin/type_uuid/mysql-test/type_uuid/suite.pm new file mode 100644 index 00000000..ad21c868 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/suite.pm @@ -0,0 +1,7 @@ +package My::Suite::Type_uuid; + +@ISA = qw(My::Suite); + +sub is_default { 1 } + +bless { }; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result new file mode 100644 index 00000000..fc0eaae2 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.result @@ -0,0 +1,18 @@ +# +# MDEV-4958 Adding datatype UUID +# +SET @old_debug_dbug=@@debug_dbug; +SET debug_dbug="+d,frm_data_type_info"; +CREATE TABLE t1 (c01 UUID, c02 UUID); +Warnings: +Note 1105 build_frm_image: Field data type info length: 12 +Note 1105 DBUG: [0] name='c01' type_info='uuid' +Note 1105 DBUG: [1] name='c02' type_info='uuid' +SET debug_dbug=@old_debug_dbug; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c01` uuid DEFAULT NULL, + `c02` uuid DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.test new file mode 100644 index 00000000..59300d16 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid-debug.test @@ -0,0 +1,14 @@ +--source include/have_debug.inc + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +SET @old_debug_dbug=@@debug_dbug; + +SET debug_dbug="+d,frm_data_type_info"; +CREATE TABLE t1 (c01 UUID, c02 UUID); +SET debug_dbug=@old_debug_dbug; + +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result new file mode 100644 index 00000000..de17d6fb --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result @@ -0,0 +1,3204 @@ +# +# MDEV-4958 Adding datatype UUID +# +# +# Basic CREATE functionality, defaults, metadata +# +CREATE TABLE t1 (a UUID AUTO_INCREMENT); +ERROR 42000: Incorrect column specifier for column 'a' +CREATE TABLE t1 (a UUID); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DESCRIBE t1; +Field Type Null Key Default Extra +a uuid YES NULL +SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND table_name='t1'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME t1 +COLUMN_NAME a +ORDINAL_POSITION 1 +COLUMN_DEFAULT NULL +IS_NULLABLE YES +DATA_TYPE uuid +CHARACTER_MAXIMUM_LENGTH NULL +CHARACTER_OCTET_LENGTH NULL +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME NULL +COLLATION_NAME NULL +COLUMN_TYPE uuid +COLUMN_KEY +EXTRA +PRIVILEGES # +COLUMN_COMMENT +IS_GENERATED NEVER +GENERATION_EXPRESSION NULL +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT * FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a 254 (type=uuid) 36 36 Y 160 0 8 +a +00000000-0000-0000-0000-000000000001 +SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID) AS a; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def a 254 (type=uuid) 36 36 N 33 0 8 +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE TABLE t1 ( +c1 UUID DEFAULT 0x00000000000000000000000000000000, +c2 UUID DEFAULT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, +c3 UUID DEFAULT '00000000-0000-0000-0000-000000000000', +c4 UUID DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff', +c5 UUID DEFAULT CAST(X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' AS UUID) +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `c2` uuid DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff', + `c3` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `c4` uuid DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff', + `c5` uuid DEFAULT cast(X'ffffffffffffffffffffffffffffffff' as uuid) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DESCRIBE t1; +Field Type Null Key Default Extra +c1 uuid YES 00000000-0000-0000-0000-000000000000 +c2 uuid YES ffffffff-ffff-ffff-ffff-ffffffffffff +c3 uuid YES 00000000-0000-0000-0000-000000000000 +c4 uuid YES ffffffff-ffff-ffff-ffff-ffffffffffff +c5 uuid YES cast(X'ffffffffffffffffffffffffffffffff' as uuid) +SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND table_name='t1'; +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME t1 +COLUMN_NAME c1 +ORDINAL_POSITION 1 +COLUMN_DEFAULT '00000000-0000-0000-0000-000000000000' +IS_NULLABLE YES +DATA_TYPE uuid +CHARACTER_MAXIMUM_LENGTH NULL +CHARACTER_OCTET_LENGTH NULL +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME NULL +COLLATION_NAME NULL +COLUMN_TYPE uuid +COLUMN_KEY +EXTRA +PRIVILEGES # +COLUMN_COMMENT +IS_GENERATED NEVER +GENERATION_EXPRESSION NULL +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME t1 +COLUMN_NAME c2 +ORDINAL_POSITION 2 +COLUMN_DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff' +IS_NULLABLE YES +DATA_TYPE uuid +CHARACTER_MAXIMUM_LENGTH NULL +CHARACTER_OCTET_LENGTH NULL +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME NULL +COLLATION_NAME NULL +COLUMN_TYPE uuid +COLUMN_KEY +EXTRA +PRIVILEGES # +COLUMN_COMMENT +IS_GENERATED NEVER +GENERATION_EXPRESSION NULL +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME t1 +COLUMN_NAME c3 +ORDINAL_POSITION 3 +COLUMN_DEFAULT '00000000-0000-0000-0000-000000000000' +IS_NULLABLE YES +DATA_TYPE uuid +CHARACTER_MAXIMUM_LENGTH NULL +CHARACTER_OCTET_LENGTH NULL +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME NULL +COLLATION_NAME NULL +COLUMN_TYPE uuid +COLUMN_KEY +EXTRA +PRIVILEGES # +COLUMN_COMMENT +IS_GENERATED NEVER +GENERATION_EXPRESSION NULL +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME t1 +COLUMN_NAME c4 +ORDINAL_POSITION 4 +COLUMN_DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff' +IS_NULLABLE YES +DATA_TYPE uuid +CHARACTER_MAXIMUM_LENGTH NULL +CHARACTER_OCTET_LENGTH NULL +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME NULL +COLLATION_NAME NULL +COLUMN_TYPE uuid +COLUMN_KEY +EXTRA +PRIVILEGES # +COLUMN_COMMENT +IS_GENERATED NEVER +GENERATION_EXPRESSION NULL +TABLE_CATALOG def +TABLE_SCHEMA test +TABLE_NAME t1 +COLUMN_NAME c5 +ORDINAL_POSITION 5 +COLUMN_DEFAULT cast(X'ffffffffffffffffffffffffffffffff' as uuid) +IS_NULLABLE YES +DATA_TYPE uuid +CHARACTER_MAXIMUM_LENGTH NULL +CHARACTER_OCTET_LENGTH NULL +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME NULL +COLLATION_NAME NULL +COLUMN_TYPE uuid +COLUMN_KEY +EXTRA +PRIVILEGES # +COLUMN_COMMENT +IS_GENERATED NEVER +GENERATION_EXPRESSION NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 UUID DEFAULT 0x00); +ERROR 42000: Invalid default value for 'c1' +CREATE TABLE t1 (c1 UUID DEFAULT ''); +ERROR 42000: Invalid default value for 'c1' +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('x'); +ERROR 22007: Incorrect uuid value: 'x' for column `test`.`t1`.`a` at row 1 +INSERT INTO t1 VALUES (1); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t1`.`a` +INSERT INTO t1 VALUES (TIME'10:20:30'); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t1`.`a` +INSERT INTO t1 VALUES (0x00); +ERROR 22007: Incorrect uuid value: '\x00' for column `test`.`t1`.`a` at row 1 +DROP TABLE t1; +# +# CAST +# +SELECT CAST('garbage' AS UUID); +CAST('garbage' AS UUID) +NULL +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT CAST(0x01 AS UUID); +CAST(0x01 AS UUID) +NULL +Warnings: +Warning 1292 Incorrect uuid value: '\x01' +SELECT CAST(REPEAT(0x00,16) AS UUID); +CAST(REPEAT(0x00,16) AS UUID) +00000000-0000-0000-0000-000000000000 +SELECT CAST(REPEAT(0x11,16) AS UUID); +CAST(REPEAT(0x11,16) AS UUID) +11111111-1111-1111-1111-111111111111 +CREATE TABLE t1 AS SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CAST('00000000-0000-0000-0000-000000000000' AS UUID)` uuid NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# Text and binary formats, comparison operators +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES (0x00000000000000000000000000000000); +INSERT INTO t1 VALUES (0x00000000000000000000000000000001); +INSERT INTO t1 VALUES (0xFFFF0000000000000000000000000001); +INSERT INTO t1 VALUES (0xFFFF0000000000000000000000000002); +SELECT * FROM t1 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000002 +SELECT * FROM t1 ORDER BY a DESC; +a +ffff0000-0000-0000-0000-000000000002 +ffff0000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000000 +SELECT HEX(a),a FROM t1 ORDER BY a; +HEX(a) a +00000000000000000000000000000000 00000000-0000-0000-0000-000000000000 +00000000000000000000000000000001 00000000-0000-0000-0000-000000000001 +FFFF0000000000000000000000000001 ffff0000-0000-0000-0000-000000000001 +FFFF0000000000000000000000000002 ffff0000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000000'; +a +00000000-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000001'; +a +00000000-0000-0000-0000-000000000001 +SELECT * FROM t1 WHERE a='ffff0000-0000-0000-0000-000000000001'; +a +ffff0000-0000-0000-0000-000000000001 +SELECT * FROM t1 WHERE a='ffff0000-0000-0000-0000-000000000002'; +a +ffff0000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE a=0x00000000000000000000000000000000; +a +00000000-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE a=0x00000000000000000000000000000001; +a +00000000-0000-0000-0000-000000000001 +SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000001; +a +ffff0000-0000-0000-0000-000000000001 +SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000002; +a +ffff0000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE a< '00000000-0000-0000-0000-000000000000'; +a +SELECT * FROM t1 WHERE a<='00000000-0000-0000-0000-000000000000'; +a +00000000-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE a>='ffff0000-0000-0000-0000-000000000002'; +a +ffff0000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE a> 'ffff0000-0000-0000-0000-000000000002'; +a +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000000', +'ffff0000-0000-0000-0000-000000000001' +) ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +ffff0000-0000-0000-0000-000000000001 +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000000', +0xffff0000000000000000000000000002 +) ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +ffff0000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE a<'garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a<='garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a='garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a>='garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a>'garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a<0x01; +a +Warnings: +Warning 1292 Incorrect uuid value: '\x01' +SELECT * FROM t1 WHERE a<=0x01; +a +Warnings: +Warning 1292 Incorrect uuid value: '\x01' +SELECT * FROM t1 WHERE a=0x01; +a +Warnings: +Warning 1292 Incorrect uuid value: '\x01' +Warning 1292 Incorrect uuid value: '\x01' +SELECT * FROM t1 WHERE a>=0x01; +a +Warnings: +Warning 1292 Incorrect uuid value: '\x01' +SELECT * FROM t1 WHERE a>0x01; +a +Warnings: +Warning 1292 Incorrect uuid value: '\x01' +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000000'; +a +00000000-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE a='00-000000-0000-0000-0000-000000000000'; +a +00000000-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE a='00-00-0000-0000-0000-0000-000000000000'; +a +00000000-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE a='00-00-00-00-0000-0000-0000-000000000000'; +a +00000000-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE a=0; +ERROR HY000: Illegal parameter data types uuid and int for operation '=' +SELECT * FROM t1 WHERE a=0.0; +ERROR HY000: Illegal parameter data types uuid and decimal for operation '=' +SELECT * FROM t1 WHERE a=0e0; +ERROR HY000: Illegal parameter data types uuid and double for operation '=' +SELECT * FROM t1 WHERE a=TIME'10:20:30'; +ERROR HY000: Illegal parameter data types uuid and time for operation '=' +SELECT * FROM t1 WHERE a IN ('::', 10); +ERROR HY000: Illegal parameter data types uuid and int for operation 'in' +DROP TABLE t1; +# +# ORDER BY +# +CREATE TABLE t1 (a UUID); +FOR i IN 0..15 +DO +INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +# +# Logical ORDER BY +# +SELECT * FROM t1 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000005 +00000000-0000-0000-0000-000000000006 +00000000-0000-0000-0000-000000000007 +00000000-0000-0000-0000-000000000008 +00000000-0000-0000-0000-000000000009 +00000000-0000-0000-0000-00000000000a +00000000-0000-0000-0000-00000000000b +00000000-0000-0000-0000-00000000000c +00000000-0000-0000-0000-00000000000d +00000000-0000-0000-0000-00000000000e +00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000100 +00000000-0000-0000-0000-000000000200 +00000000-0000-0000-0000-000000000300 +00000000-0000-0000-0000-000000000400 +00000000-0000-0000-0000-000000000500 +00000000-0000-0000-0000-000000000600 +00000000-0000-0000-0000-000000000700 +00000000-0000-0000-0000-000000000800 +00000000-0000-0000-0000-000000000900 +00000000-0000-0000-0000-000000000a00 +00000000-0000-0000-0000-000000000b00 +00000000-0000-0000-0000-000000000c00 +00000000-0000-0000-0000-000000000d00 +00000000-0000-0000-0000-000000000e00 +00000000-0000-0000-0000-000000000f00 +00000000-0000-0000-0000-000000010000 +00000000-0000-0000-0000-000000020000 +00000000-0000-0000-0000-000000030000 +00000000-0000-0000-0000-000000040000 +00000000-0000-0000-0000-000000050000 +00000000-0000-0000-0000-000000060000 +00000000-0000-0000-0000-000000070000 +00000000-0000-0000-0000-000000080000 +00000000-0000-0000-0000-000000090000 +00000000-0000-0000-0000-0000000a0000 +00000000-0000-0000-0000-0000000b0000 +00000000-0000-0000-0000-0000000c0000 +00000000-0000-0000-0000-0000000d0000 +00000000-0000-0000-0000-0000000e0000 +00000000-0000-0000-0000-0000000f0000 +00000000-0000-0000-0000-000001000000 +00000000-0000-0000-0000-000002000000 +00000000-0000-0000-0000-000003000000 +00000000-0000-0000-0000-000004000000 +00000000-0000-0000-0000-000005000000 +00000000-0000-0000-0000-000006000000 +00000000-0000-0000-0000-000007000000 +00000000-0000-0000-0000-000008000000 +00000000-0000-0000-0000-000009000000 +00000000-0000-0000-0000-00000a000000 +00000000-0000-0000-0000-00000b000000 +00000000-0000-0000-0000-00000c000000 +00000000-0000-0000-0000-00000d000000 +00000000-0000-0000-0000-00000e000000 +00000000-0000-0000-0000-00000f000000 +00000000-0000-0000-0000-000100000000 +00000000-0000-0000-0000-000200000000 +00000000-0000-0000-0000-000300000000 +00000000-0000-0000-0000-000400000000 +00000000-0000-0000-0000-000500000000 +00000000-0000-0000-0000-000600000000 +00000000-0000-0000-0000-000700000000 +00000000-0000-0000-0000-000800000000 +00000000-0000-0000-0000-000900000000 +00000000-0000-0000-0000-000a00000000 +00000000-0000-0000-0000-000b00000000 +00000000-0000-0000-0000-000c00000000 +00000000-0000-0000-0000-000d00000000 +00000000-0000-0000-0000-000e00000000 +00000000-0000-0000-0000-000f00000000 +00000000-0000-0000-0000-010000000000 +00000000-0000-0000-0000-020000000000 +00000000-0000-0000-0000-030000000000 +00000000-0000-0000-0000-040000000000 +00000000-0000-0000-0000-050000000000 +00000000-0000-0000-0000-060000000000 +00000000-0000-0000-0000-070000000000 +00000000-0000-0000-0000-080000000000 +00000000-0000-0000-0000-090000000000 +00000000-0000-0000-0000-0a0000000000 +00000000-0000-0000-0000-0b0000000000 +00000000-0000-0000-0000-0c0000000000 +00000000-0000-0000-0000-0d0000000000 +00000000-0000-0000-0000-0e0000000000 +00000000-0000-0000-0000-0f0000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 +SELECT COALESCE(NULL, a) FROM t1 ORDER BY a; +COALESCE(NULL, a) +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000005 +00000000-0000-0000-0000-000000000006 +00000000-0000-0000-0000-000000000007 +00000000-0000-0000-0000-000000000008 +00000000-0000-0000-0000-000000000009 +00000000-0000-0000-0000-00000000000a +00000000-0000-0000-0000-00000000000b +00000000-0000-0000-0000-00000000000c +00000000-0000-0000-0000-00000000000d +00000000-0000-0000-0000-00000000000e +00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000100 +00000000-0000-0000-0000-000000000200 +00000000-0000-0000-0000-000000000300 +00000000-0000-0000-0000-000000000400 +00000000-0000-0000-0000-000000000500 +00000000-0000-0000-0000-000000000600 +00000000-0000-0000-0000-000000000700 +00000000-0000-0000-0000-000000000800 +00000000-0000-0000-0000-000000000900 +00000000-0000-0000-0000-000000000a00 +00000000-0000-0000-0000-000000000b00 +00000000-0000-0000-0000-000000000c00 +00000000-0000-0000-0000-000000000d00 +00000000-0000-0000-0000-000000000e00 +00000000-0000-0000-0000-000000000f00 +00000000-0000-0000-0000-000000010000 +00000000-0000-0000-0000-000000020000 +00000000-0000-0000-0000-000000030000 +00000000-0000-0000-0000-000000040000 +00000000-0000-0000-0000-000000050000 +00000000-0000-0000-0000-000000060000 +00000000-0000-0000-0000-000000070000 +00000000-0000-0000-0000-000000080000 +00000000-0000-0000-0000-000000090000 +00000000-0000-0000-0000-0000000a0000 +00000000-0000-0000-0000-0000000b0000 +00000000-0000-0000-0000-0000000c0000 +00000000-0000-0000-0000-0000000d0000 +00000000-0000-0000-0000-0000000e0000 +00000000-0000-0000-0000-0000000f0000 +00000000-0000-0000-0000-000001000000 +00000000-0000-0000-0000-000002000000 +00000000-0000-0000-0000-000003000000 +00000000-0000-0000-0000-000004000000 +00000000-0000-0000-0000-000005000000 +00000000-0000-0000-0000-000006000000 +00000000-0000-0000-0000-000007000000 +00000000-0000-0000-0000-000008000000 +00000000-0000-0000-0000-000009000000 +00000000-0000-0000-0000-00000a000000 +00000000-0000-0000-0000-00000b000000 +00000000-0000-0000-0000-00000c000000 +00000000-0000-0000-0000-00000d000000 +00000000-0000-0000-0000-00000e000000 +00000000-0000-0000-0000-00000f000000 +00000000-0000-0000-0000-000100000000 +00000000-0000-0000-0000-000200000000 +00000000-0000-0000-0000-000300000000 +00000000-0000-0000-0000-000400000000 +00000000-0000-0000-0000-000500000000 +00000000-0000-0000-0000-000600000000 +00000000-0000-0000-0000-000700000000 +00000000-0000-0000-0000-000800000000 +00000000-0000-0000-0000-000900000000 +00000000-0000-0000-0000-000a00000000 +00000000-0000-0000-0000-000b00000000 +00000000-0000-0000-0000-000c00000000 +00000000-0000-0000-0000-000d00000000 +00000000-0000-0000-0000-000e00000000 +00000000-0000-0000-0000-000f00000000 +00000000-0000-0000-0000-010000000000 +00000000-0000-0000-0000-020000000000 +00000000-0000-0000-0000-030000000000 +00000000-0000-0000-0000-040000000000 +00000000-0000-0000-0000-050000000000 +00000000-0000-0000-0000-060000000000 +00000000-0000-0000-0000-070000000000 +00000000-0000-0000-0000-080000000000 +00000000-0000-0000-0000-090000000000 +00000000-0000-0000-0000-0a0000000000 +00000000-0000-0000-0000-0b0000000000 +00000000-0000-0000-0000-0c0000000000 +00000000-0000-0000-0000-0d0000000000 +00000000-0000-0000-0000-0e0000000000 +00000000-0000-0000-0000-0f0000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 +# +# Lexicographical ORDER BY +# +SELECT * FROM t1 ORDER BY CAST(a AS BINARY(16)); +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000005 +00000000-0000-0000-0000-000000000006 +00000000-0000-0000-0000-000000000007 +00000000-0000-0000-0000-000000000008 +00000000-0000-0000-0000-000000000009 +00000000-0000-0000-0000-00000000000a +00000000-0000-0000-0000-00000000000b +00000000-0000-0000-0000-00000000000c +00000000-0000-0000-0000-00000000000d +00000000-0000-0000-0000-00000000000e +00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000100 +00000000-0000-0000-0000-000000000200 +00000000-0000-0000-0000-000000000300 +00000000-0000-0000-0000-000000000400 +00000000-0000-0000-0000-000000000500 +00000000-0000-0000-0000-000000000600 +00000000-0000-0000-0000-000000000700 +00000000-0000-0000-0000-000000000800 +00000000-0000-0000-0000-000000000900 +00000000-0000-0000-0000-000000000a00 +00000000-0000-0000-0000-000000000b00 +00000000-0000-0000-0000-000000000c00 +00000000-0000-0000-0000-000000000d00 +00000000-0000-0000-0000-000000000e00 +00000000-0000-0000-0000-000000000f00 +00000000-0000-0000-0000-000000010000 +00000000-0000-0000-0000-000000020000 +00000000-0000-0000-0000-000000030000 +00000000-0000-0000-0000-000000040000 +00000000-0000-0000-0000-000000050000 +00000000-0000-0000-0000-000000060000 +00000000-0000-0000-0000-000000070000 +00000000-0000-0000-0000-000000080000 +00000000-0000-0000-0000-000000090000 +00000000-0000-0000-0000-0000000a0000 +00000000-0000-0000-0000-0000000b0000 +00000000-0000-0000-0000-0000000c0000 +00000000-0000-0000-0000-0000000d0000 +00000000-0000-0000-0000-0000000e0000 +00000000-0000-0000-0000-0000000f0000 +00000000-0000-0000-0000-000001000000 +00000000-0000-0000-0000-000002000000 +00000000-0000-0000-0000-000003000000 +00000000-0000-0000-0000-000004000000 +00000000-0000-0000-0000-000005000000 +00000000-0000-0000-0000-000006000000 +00000000-0000-0000-0000-000007000000 +00000000-0000-0000-0000-000008000000 +00000000-0000-0000-0000-000009000000 +00000000-0000-0000-0000-00000a000000 +00000000-0000-0000-0000-00000b000000 +00000000-0000-0000-0000-00000c000000 +00000000-0000-0000-0000-00000d000000 +00000000-0000-0000-0000-00000e000000 +00000000-0000-0000-0000-00000f000000 +00000000-0000-0000-0000-000100000000 +00000000-0000-0000-0000-000200000000 +00000000-0000-0000-0000-000300000000 +00000000-0000-0000-0000-000400000000 +00000000-0000-0000-0000-000500000000 +00000000-0000-0000-0000-000600000000 +00000000-0000-0000-0000-000700000000 +00000000-0000-0000-0000-000800000000 +00000000-0000-0000-0000-000900000000 +00000000-0000-0000-0000-000a00000000 +00000000-0000-0000-0000-000b00000000 +00000000-0000-0000-0000-000c00000000 +00000000-0000-0000-0000-000d00000000 +00000000-0000-0000-0000-000e00000000 +00000000-0000-0000-0000-000f00000000 +00000000-0000-0000-0000-010000000000 +00000000-0000-0000-0000-020000000000 +00000000-0000-0000-0000-030000000000 +00000000-0000-0000-0000-040000000000 +00000000-0000-0000-0000-050000000000 +00000000-0000-0000-0000-060000000000 +00000000-0000-0000-0000-070000000000 +00000000-0000-0000-0000-080000000000 +00000000-0000-0000-0000-090000000000 +00000000-0000-0000-0000-0a0000000000 +00000000-0000-0000-0000-0b0000000000 +00000000-0000-0000-0000-0c0000000000 +00000000-0000-0000-0000-0d0000000000 +00000000-0000-0000-0000-0e0000000000 +00000000-0000-0000-0000-0f0000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 +SELECT * FROM t1 ORDER BY CAST(COALESCE(NULL,a) AS BINARY(16)); +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000005 +00000000-0000-0000-0000-000000000006 +00000000-0000-0000-0000-000000000007 +00000000-0000-0000-0000-000000000008 +00000000-0000-0000-0000-000000000009 +00000000-0000-0000-0000-00000000000a +00000000-0000-0000-0000-00000000000b +00000000-0000-0000-0000-00000000000c +00000000-0000-0000-0000-00000000000d +00000000-0000-0000-0000-00000000000e +00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000100 +00000000-0000-0000-0000-000000000200 +00000000-0000-0000-0000-000000000300 +00000000-0000-0000-0000-000000000400 +00000000-0000-0000-0000-000000000500 +00000000-0000-0000-0000-000000000600 +00000000-0000-0000-0000-000000000700 +00000000-0000-0000-0000-000000000800 +00000000-0000-0000-0000-000000000900 +00000000-0000-0000-0000-000000000a00 +00000000-0000-0000-0000-000000000b00 +00000000-0000-0000-0000-000000000c00 +00000000-0000-0000-0000-000000000d00 +00000000-0000-0000-0000-000000000e00 +00000000-0000-0000-0000-000000000f00 +00000000-0000-0000-0000-000000010000 +00000000-0000-0000-0000-000000020000 +00000000-0000-0000-0000-000000030000 +00000000-0000-0000-0000-000000040000 +00000000-0000-0000-0000-000000050000 +00000000-0000-0000-0000-000000060000 +00000000-0000-0000-0000-000000070000 +00000000-0000-0000-0000-000000080000 +00000000-0000-0000-0000-000000090000 +00000000-0000-0000-0000-0000000a0000 +00000000-0000-0000-0000-0000000b0000 +00000000-0000-0000-0000-0000000c0000 +00000000-0000-0000-0000-0000000d0000 +00000000-0000-0000-0000-0000000e0000 +00000000-0000-0000-0000-0000000f0000 +00000000-0000-0000-0000-000001000000 +00000000-0000-0000-0000-000002000000 +00000000-0000-0000-0000-000003000000 +00000000-0000-0000-0000-000004000000 +00000000-0000-0000-0000-000005000000 +00000000-0000-0000-0000-000006000000 +00000000-0000-0000-0000-000007000000 +00000000-0000-0000-0000-000008000000 +00000000-0000-0000-0000-000009000000 +00000000-0000-0000-0000-00000a000000 +00000000-0000-0000-0000-00000b000000 +00000000-0000-0000-0000-00000c000000 +00000000-0000-0000-0000-00000d000000 +00000000-0000-0000-0000-00000e000000 +00000000-0000-0000-0000-00000f000000 +00000000-0000-0000-0000-000100000000 +00000000-0000-0000-0000-000200000000 +00000000-0000-0000-0000-000300000000 +00000000-0000-0000-0000-000400000000 +00000000-0000-0000-0000-000500000000 +00000000-0000-0000-0000-000600000000 +00000000-0000-0000-0000-000700000000 +00000000-0000-0000-0000-000800000000 +00000000-0000-0000-0000-000900000000 +00000000-0000-0000-0000-000a00000000 +00000000-0000-0000-0000-000b00000000 +00000000-0000-0000-0000-000c00000000 +00000000-0000-0000-0000-000d00000000 +00000000-0000-0000-0000-000e00000000 +00000000-0000-0000-0000-000f00000000 +00000000-0000-0000-0000-010000000000 +00000000-0000-0000-0000-020000000000 +00000000-0000-0000-0000-030000000000 +00000000-0000-0000-0000-040000000000 +00000000-0000-0000-0000-050000000000 +00000000-0000-0000-0000-060000000000 +00000000-0000-0000-0000-070000000000 +00000000-0000-0000-0000-080000000000 +00000000-0000-0000-0000-090000000000 +00000000-0000-0000-0000-0a0000000000 +00000000-0000-0000-0000-0b0000000000 +00000000-0000-0000-0000-0c0000000000 +00000000-0000-0000-0000-0d0000000000 +00000000-0000-0000-0000-0e0000000000 +00000000-0000-0000-0000-0f0000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 +DROP TABLE t1; +# +# cmp_item_uuid: IN for non-constants +# +CREATE TABLE t1 (a UUID, b UUID); +INSERT INTO t1 VALUES +( +'00000000-0000-0000-0000-000000000001', +'00000000-0000-0000-0000-000000000002' +); +SELECT * FROM t1 WHERE '00000000-0000-0000-0000-000000000000' IN (a, b); +a b +SELECT * FROM t1 WHERE '00000000-0000-0000-0000-000000000001' IN (a, b); +a b +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE '00-000000-0000-0000-0000-000000000001' IN (a, b); +a b +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE '00-00-0000-0000-0000-0000-000000000001' IN (a, b); +a b +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002 +DROP TABLE t1; +# +# cmp_item_uuid: DECODE_ORACLE +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +(NULL), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT a, DECODE_ORACLE(a, '00000000-0000-0000-0000-000000000002', '01') AS d FROM t1; +a d +NULL NULL +00000000-0000-0000-0000-000000000001 NULL +00000000-0000-0000-0000-000000000002 01 +SELECT +a, +DECODE_ORACLE(a, '00000000-0000-0000-0000-000000000001', '01') AS d0, +DECODE_ORACLE(a, NULL, '<NULL>', '00000000-0000-0000-0000-000000000001', '01') AS d1, +DECODE_ORACLE(a, 'garbage', '<NULL>', '00000000-0000-0000-0000-000000000001', '01') AS d2 +FROM t1; +a d0 d1 d2 +NULL NULL <NULL> <NULL> +00000000-0000-0000-0000-000000000001 01 01 01 +00000000-0000-0000-0000-000000000002 NULL NULL NULL +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +DROP TABLE t1; +# +# CASE abbreviations +# +CREATE TABLE t1 ( +c UUID, +c_char CHAR(32), +c_varchar VARCHAR(32), +c_tinytext TINYTEXT, +c_text TEXT, +c_mediumtext TEXT, +c_longtext LONGTEXT +); +CREATE TABLE t2 AS SELECT +COALESCE(c, c_char), +COALESCE(c, c_varchar), +COALESCE(c, c_tinytext), +COALESCE(c, c_text), +COALESCE(c, c_mediumtext), +COALESCE(c, c_longtext) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(c, c_char)` uuid DEFAULT NULL, + `COALESCE(c, c_varchar)` uuid DEFAULT NULL, + `COALESCE(c, c_tinytext)` uuid DEFAULT NULL, + `COALESCE(c, c_text)` uuid DEFAULT NULL, + `COALESCE(c, c_mediumtext)` uuid DEFAULT NULL, + `COALESCE(c, c_longtext)` uuid DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +LEAST(c, c_char), +LEAST(c, c_varchar), +LEAST(c, c_tinytext), +LEAST(c, c_text), +LEAST(c, c_mediumtext), +LEAST(c, c_longtext) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(c, c_char)` uuid DEFAULT NULL, + `LEAST(c, c_varchar)` uuid DEFAULT NULL, + `LEAST(c, c_tinytext)` uuid DEFAULT NULL, + `LEAST(c, c_text)` uuid DEFAULT NULL, + `LEAST(c, c_mediumtext)` uuid DEFAULT NULL, + `LEAST(c, c_longtext)` uuid DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +(NULL), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT COALESCE(a, '00000000-0000-0000-0000-000000000000') FROM t1 ORDER BY a; +COALESCE(a, '00000000-0000-0000-0000-000000000000') +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +SELECT +a, +LEAST(a,'00000000-0000-0000-0000-000000000000'), +LEAST(a,'00000000-0000-0000-0000-00000000000f') +FROM t1 ORDER BY a; +a LEAST(a,'00000000-0000-0000-0000-000000000000') LEAST(a,'00000000-0000-0000-0000-00000000000f') +NULL NULL NULL +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002 +SELECT +a, +GREATEST(a,'00000000-0000-0000-0000-000000000000'), +GREATEST(a,'00000000-0000-0000-0000-00000000000f') +FROM t1 ORDER BY a; +a GREATEST(a,'00000000-0000-0000-0000-000000000000') GREATEST(a,'00000000-0000-0000-0000-00000000000f') +NULL NULL NULL +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-00000000000f +CREATE TABLE t2 AS SELECT +COALESCE(a, '00000000-0000-0000-0000-000000000000'), +LEAST(a,'00000000-0000-0000-0000-000000000000'), +GREATEST(a,'00000000-0000-0000-0000-000000000000') +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a, '00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL, + `LEAST(a,'00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL, + `GREATEST(a,'00000000-0000-0000-0000-000000000000')` uuid DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +SELECT COALESCE(a, 0x00000000000000000000000000000000) FROM t1 ORDER BY a; +COALESCE(a, 0x00000000000000000000000000000000) +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +SELECT +a, +LEAST(a, 0x00000000000000000000000000000000), +LEAST(a, 0x0000000000000000000000000000000f) +FROM t1 ORDER BY a; +a LEAST(a, 0x00000000000000000000000000000000) LEAST(a, 0x0000000000000000000000000000000f) +NULL NULL NULL +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002 +SELECT +a, +GREATEST(a, 0x00000000000000000000000000000000), +GREATEST(a, 0x0000000000000000000000000000000f) +FROM t1 ORDER BY a; +a GREATEST(a, 0x00000000000000000000000000000000) GREATEST(a, 0x0000000000000000000000000000000f) +NULL NULL NULL +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-00000000000f +00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-00000000000f +CREATE TABLE t2 AS SELECT +COALESCE(a, 0x00000000000000000000000000000000), +LEAST(a,0x00000000000000000000000000000000), +GREATEST(a,0x00000000000000000000000000000000) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a, 0x00000000000000000000000000000000)` uuid DEFAULT NULL, + `LEAST(a,0x00000000000000000000000000000000)` uuid DEFAULT NULL, + `GREATEST(a,0x00000000000000000000000000000000)` uuid DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +SELECT COALESCE(a, 10) FROM t1; +ERROR HY000: Illegal parameter data types uuid and int for operation 'coalesce' +SELECT LEAST(a, 10) FROM t1; +ERROR HY000: Illegal parameter data types uuid and int for operation 'least' +SELECT GREATEST(a, 10) FROM t1; +ERROR HY000: Illegal parameter data types uuid and int for operation 'greatest' +DROP TABLE t1; +SELECT COALESCE('garbage', CAST('::1' AS UUID)); +COALESCE('garbage', CAST('::1' AS UUID)) +NULL +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: '::1' +SELECT COALESCE(0x01, CAST('::1' AS UUID)); +COALESCE(0x01, CAST('::1' AS UUID)) +NULL +Warnings: +Warning 1292 Incorrect uuid value: '\x01' +Warning 1292 Incorrect uuid value: '::1' +# +# Uniqueness +# +CREATE TABLE t1 (a UUID NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES +('41000000-0000-0000-0000-000000000001'), +('61000000-0000-0000-0000-000000000001'); +INSERT INTO t1 VALUES ('41000000-0000-0000-0000-000000000001'); +ERROR 23000: Duplicate entry '41000000-0000-0000-0000-000000000001' for key 'PRIMARY' +SELECT * FROM t1; +a +41000000-0000-0000-0000-000000000001 +61000000-0000-0000-0000-000000000001 +DROP TABLE t1; +# +# Indexes +# +CREATE TABLE t1 (a UUID, KEY(a(1))); +ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys +# +# Explicit CAST on INSERT +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000001' AS UUID)); +INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000002' AS UUID)); +INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000003' AS UUID)); +INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000001') AS UUID)); +INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000002') AS UUID)); +INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000003') AS UUID)); +SELECT * FROM t1 ORDER BY a; +a +10000000-0000-0000-0000-000000000001 +10000000-0000-0000-0000-000000000002 +10000000-0000-0000-0000-000000000003 +20000000-0000-0000-0000-000000000001 +20000000-0000-0000-0000-000000000002 +20000000-0000-0000-0000-000000000003 +DROP TABLE t1; +# +# Explicit CAST and implicit CAST on ALTER +# +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('garbage'), +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('ffff0000-0000-0000-0000-000000000001'), +('ffff0000-0000-0000-0000-000000000002'); +SELECT a, CAST(a AS UUID) FROM t1 ORDER BY a; +a CAST(a AS UUID) +00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000001 ffff0000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000002 ffff0000-0000-0000-0000-000000000002 +garbage NULL +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT a, CAST(a AS UUID) FROM t1 ORDER BY CAST(a AS UUID); +a CAST(a AS UUID) +garbage NULL +00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000001 ffff0000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000002 ffff0000-0000-0000-0000-000000000002 +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +ALTER TABLE t1 MODIFY a UUID; +ERROR 22007: Incorrect uuid value: 'garbage' for column `test`.`t1`.`a` at row 1 +SET sql_mode=''; +ALTER TABLE t1 MODIFY a UUID; +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' for column `test`.`t1`.`a` at row 1 +SET sql_mode=DEFAULT; +SELECT * FROM t1 ORDER BY a; +a +NULL +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000002 +DROP TABLE t1; +CREATE TABLE t1 (a BINARY(16)); +INSERT INTO t1 VALUES (0x00000000000000000000000000000000); +INSERT INTO t1 VALUES (0x00000000000000000000000000000001); +INSERT INTO t1 VALUES (0xffff0000000000000000000000000001); +INSERT INTO t1 VALUES (0xffff0000000000000000000000000002); +SELECT HEX(a), CAST(a AS UUID) FROM t1 ORDER BY a; +HEX(a) CAST(a AS UUID) +00000000000000000000000000000000 00000000-0000-0000-0000-000000000000 +00000000000000000000000000000001 00000000-0000-0000-0000-000000000001 +FFFF0000000000000000000000000001 ffff0000-0000-0000-0000-000000000001 +FFFF0000000000000000000000000002 ffff0000-0000-0000-0000-000000000002 +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000002 +DROP TABLE t1; +# +# INSERT..SELECT, same data types +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +CREATE TABLE t2 (a UUID); +INSERT INTO t2 SELECT a FROM t1; +SELECT * FROM t2; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +DROP TABLE t1,t2; +# +# Implicit CAST on INSERT..SELECT, text format +# +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('garbage'), +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('ffff0000-0000-0000-0000-000000000001'), +('ffff0000-0000-0000-0000-000000000002'); +CREATE TABLE t2 (a UUID); +INSERT INTO t2 SELECT a FROM t1; +ERROR 22007: Incorrect uuid value: 'garbage' for column `test`.`t2`.`a` at row 1 +SET sql_mode=''; +INSERT INTO t2 SELECT a FROM t1; +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' for column `test`.`t2`.`a` at row 1 +SELECT * FROM t2 ORDER BY a; +a +NULL +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000002 +SET sql_mode=DEFAULT; +DROP TABLE t2; +CREATE TABLE t2 (a UUID NOT NULL); +INSERT INTO t2 SELECT a FROM t1; +ERROR 22007: Incorrect uuid value: 'garbage' for column `test`.`t2`.`a` at row 1 +SET sql_mode=''; +INSERT INTO t2 SELECT a FROM t1; +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' for column `test`.`t2`.`a` at row 1 +SELECT * FROM t2 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000002 +SET sql_mode=DEFAULT; +DROP TABLE t2; +DROP TABLE t1; +# +# Implicit CAST on INSERT..SELECT, binary format +# +CREATE TABLE t1 (a BINARY(16)); +INSERT INTO t1 VALUES (0x00000000000000000000000000000000); +INSERT INTO t1 VALUES (0x00000000000000000000000000000001); +INSERT INTO t1 VALUES (0xffff0000000000000000000000000001); +INSERT INTO t1 VALUES (0xffff0000000000000000000000000002); +CREATE TABLE t2 (a UUID); +INSERT INTO t2 SELECT a FROM t1; +SELECT a FROM t2 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000001 +ffff0000-0000-0000-0000-000000000002 +DROP TABLE t1,t2; +# +# CAST to other data types +# +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DOUBLE); +ERROR HY000: Illegal parameter data type uuid for operation 'double_typecast' +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS FLOAT); +ERROR HY000: Illegal parameter data type uuid for operation 'float_typecast' +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DECIMAL); +ERROR HY000: Illegal parameter data type uuid for operation 'decimal_typecast' +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS SIGNED); +ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_signed' +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS UNSIGNED); +ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_unsigned' +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS TIME); +ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_time' +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DATE); +ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_date' +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DATETIME); +ERROR HY000: Illegal parameter data type uuid for operation 'cast_as_datetime' +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR); +CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR) +00000000-0000-0000-0000-000000000000 +CREATE TABLE t1 AS SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); +CREATE TABLE t2 AS SELECT +CAST(a AS CHAR), +CAST(a AS CHAR(36)), +CAST(a AS CHAR(530)), +CAST(a AS CHAR(65535)), +CAST(a AS CHAR(66000)), +CAST(a AS CHAR(16777215)), +CAST(a AS CHAR(16777216)) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CAST(a AS CHAR)` varchar(36) DEFAULT NULL, + `CAST(a AS CHAR(36))` varchar(36) DEFAULT NULL, + `CAST(a AS CHAR(530))` text DEFAULT NULL, + `CAST(a AS CHAR(65535))` text DEFAULT NULL, + `CAST(a AS CHAR(66000))` mediumtext DEFAULT NULL, + `CAST(a AS CHAR(16777215))` mediumtext DEFAULT NULL, + `CAST(a AS CHAR(16777216))` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t2; +CAST(a AS CHAR) ffffffff-ffff-ffff-ffff-ffffffffffff +CAST(a AS CHAR(36)) ffffffff-ffff-ffff-ffff-ffffffffffff +CAST(a AS CHAR(530)) ffffffff-ffff-ffff-ffff-ffffffffffff +CAST(a AS CHAR(65535)) ffffffff-ffff-ffff-ffff-ffffffffffff +CAST(a AS CHAR(66000)) ffffffff-ffff-ffff-ffff-ffffffffffff +CAST(a AS CHAR(16777215)) ffffffff-ffff-ffff-ffff-ffffffffffff +CAST(a AS CHAR(16777216)) ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); +CREATE TABLE t2 AS SELECT +CAST(a AS BINARY(4)) AS cb4, +CAST(a AS BINARY) AS cb, +CAST(a AS BINARY(16)) AS cb16, +CAST(a AS BINARY(32)) AS cb32, +CAST(a AS BINARY(530)) AS cb530, +CAST(a AS BINARY(65535)) AS cb65535, +CAST(a AS BINARY(66000)) AS cb66000, +CAST(a AS BINARY(16777215)) AS cb16777215, +CAST(a AS BINARY(16777216)) AS cb16777216 +FROM t1 LIMIT 0; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `cb4` binary(4) DEFAULT NULL, + `cb` binary(16) DEFAULT NULL, + `cb16` binary(16) DEFAULT NULL, + `cb32` binary(32) DEFAULT NULL, + `cb530` varbinary(530) DEFAULT NULL, + `cb65535` blob DEFAULT NULL, + `cb66000` mediumblob DEFAULT NULL, + `cb16777215` mediumblob DEFAULT NULL, + `cb16777216` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +CAST(a AS BINARY(4)) AS cb4, +CAST(a AS BINARY) AS cb, +CAST(a AS BINARY(16)) AS cb16, +CAST(a AS BINARY(32)) AS cb32, +CAST(a AS BINARY(530)) AS cb530, +CAST(a AS BINARY(65535)) AS cb65535 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `cb4` binary(4) DEFAULT NULL, + `cb` binary(16) DEFAULT NULL, + `cb16` binary(16) DEFAULT NULL, + `cb32` binary(32) DEFAULT NULL, + `cb530` varbinary(530) DEFAULT NULL, + `cb65535` blob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT +HEX(cb4), +HEX(cb), +HEX(cb16), +HEX(cb32), +LENGTH(cb530), +LENGTH(cb65535) +FROM t2; +HEX(cb4) FFFFFFFF +HEX(cb) FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +HEX(cb16) FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +HEX(cb32) FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 +LENGTH(cb530) 530 +LENGTH(cb65535) 65535 +DROP TABLE t2; +DROP TABLE t1; +# +# Implicit conversion to other types in INSERT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t1`.`a` +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t1`.`a` +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(32,0)); +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t1`.`a` +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +DROP TABLE t1; +CREATE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +DROP TABLE t1; +# +# Boolean context +# +SELECT +CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS TRUE, +CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS FALSE, +CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS TRUE, +CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS FALSE; +CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS TRUE CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS FALSE CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS TRUE CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS FALSE +0 1 1 0 +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'); +SELECT a, a IS TRUE, a IS FALSE FROM t1 ORDER BY a; +a a IS TRUE a IS FALSE +00000000-0000-0000-0000-000000000000 0 1 +00000000-0000-0000-0000-000000000001 1 0 +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT * FROM t1 WHERE a; +ERROR HY000: Illegal parameter data types uuid and bigint for operation '<>' +DROP TABLE t1; +# +# GROUP BY +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-0000-00000000'); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-0000-00000001'), +('00000000-0000-0000-0000-0000-0000-0001'); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-0000-00000002'), +('00000000-0000-0000-0000-0000-0000-0002'); +SELECT a, COUNT(*) FROM t1 GROUP BY a; +a COUNT(*) +00000000-0000-0000-0000-000000000000 2 +00000000-0000-0000-0000-000000000001 3 +00000000-0000-0000-0000-000000000002 4 +DROP TABLE t1; +# +# Aggregate functions +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000000'); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-0000-00000001'), +('00000000-0000-0000-0000-0000-0000-0001'); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000002'); +SELECT MIN(a),MAX(a) FROM t1; +MIN(a) MAX(a) +00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002 +CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `MIN(a)` uuid DEFAULT NULL, + `MAX(a)` uuid DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t2; +MIN(a) MAX(a) +00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000002 +DROP TABLE t2; +SELECT AVG(a) FROM t1; +ERROR HY000: Illegal parameter data type uuid for operation 'avg(' +SELECT AVG(DISTINCT a) FROM t1; +ERROR HY000: Illegal parameter data type uuid for operation 'avg(distinct ' +SELECT SUM(a) FROM t1; +ERROR HY000: Illegal parameter data type uuid for operation 'sum(' +SELECT SUM(DISTINCT a) FROM t1; +ERROR HY000: Illegal parameter data type uuid for operation 'sum(distinct ' +SELECT STDDEV(a) FROM t1; +ERROR HY000: Illegal parameter data type uuid for operation 'std(' +SELECT GROUP_CONCAT(a ORDER BY a) FROM t1; +GROUP_CONCAT(a ORDER BY a) +00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002 +SELECT a, GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a; +a GROUP_CONCAT(a ORDER BY a) +00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002,00000000-0000-0000-0000-000000000002 +DROP TABLE t1; +# +# Window functions +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000003'), +('00000000-0000-0000-0000-000000000004'); +SELECT +a, +LAG(a) OVER (ORDER BY a), +LEAD(a) OVER (ORDER BY a) +FROM t1 ORDER BY a; +a LAG(a) OVER (ORDER BY a) LEAD(a) OVER (ORDER BY a) +00000000-0000-0000-0000-000000000001 NULL 00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000003 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000004 00000000-0000-0000-0000-000000000003 NULL +SELECT +a, +FIRST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), +LAST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +FROM t1 ORDER BY a; +a FIRST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) LAST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000003 +00000000-0000-0000-0000-000000000003 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000004 +00000000-0000-0000-0000-000000000004 00000000-0000-0000-0000-000000000003 00000000-0000-0000-0000-000000000004 +DROP TABLE t1; +# +# Prepared statements +# +EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ? AS a' + USING CAST('00000000-0000-0000-0000-000000000000' AS UUID); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' + USING '00000000-0000-0000-0000-000000000001'; +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' + USING CAST('00000000-0000-0000-0000-000000000002' AS UUID); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' + USING 0x00000000000000000000000000000003; +SELECT a FROM t1 ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +00000000-0000-0000-0000-000000000003 +EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' + USING '00000000-0000-0000-0000-000000000001'; +a +00000000-0000-0000-0000-000000000001 +EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' + USING CAST('00000000-0000-0000-0000-000000000002' AS UUID); +a +00000000-0000-0000-0000-000000000002 +EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' + USING 0x00000000000000000000000000000003; +a +00000000-0000-0000-0000-000000000003 +DROP TABLE t1; +# +# Character set and collation aggregation +# +CREATE TABLE t1 (a UUID); +CREATE TABLE t2 AS SELECT +CONCAT(a) AS c1, +CONCAT(CAST('00000000-0000-0000-0000-000000000000' AS UUID)) AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(36) DEFAULT NULL, + `c2` varchar(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +CONCAT(_utf8'1', LEFT(a,35)) AS c1, +CONCAT(_utf8'1', LEFT(CAST('00000000-0000-0000-0000-000000000000' AS UUID),35)) AS c2, +CONCAT(_utf8'1', LEFT(COALESCE(a),35)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c2` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `c3` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +CONCAT(_latin1'1', LEFT(a,35)) AS c1, +CONCAT(_latin1'1', LEFT(CAST('00000000-0000-0000-0000-000000000000' AS UUID),35)) AS c2, +CONCAT(_latin1'1', LEFT(COALESCE(a),35)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(36) DEFAULT NULL, + `c2` varchar(36) DEFAULT NULL, + `c3` varchar(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t2; +DROP TABLE t1; +# +# UNION +# +CREATE TABLE t1 AS +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c +UNION +SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1 ORDER BY c; +c +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c +UNION +SELECT '00000000-0000-0000-0000-000000000001'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1 ORDER BY c; +c +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT '00000000-0000-0000-0000-000000000000' AS c +UNION +SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1 ORDER BY c; +c +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c +UNION +SELECT 0x00000000000000000000000000000001; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT * FROM t1 ORDER BY c; +c +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE TABLE t1 AS +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c +UNION +SELECT 1; +ERROR HY000: Illegal parameter data types uuid and int for operation 'UNION' +# +# Unary operators +# +SELECT -CAST('00000000-0000-0000-0000-000000000000' AS UUID); +ERROR HY000: Illegal parameter data type uuid for operation '-' +SELECT ABS(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'abs' +SELECT ROUND(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'round' +SELECT CEILING(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'ceiling' +SELECT FLOOR(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'floor' +# +# Arithmetic operators +# +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) + 1; +ERROR HY000: Illegal parameter data types uuid and int for operation '+' +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) - 1; +ERROR HY000: Illegal parameter data types uuid and int for operation '-' +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) * 1; +ERROR HY000: Illegal parameter data types uuid and int for operation '*' +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) / 1; +ERROR HY000: Illegal parameter data types uuid and int for operation '/' +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) MOD 1; +ERROR HY000: Illegal parameter data types uuid and int for operation 'MOD' +# +# Misc +# +SELECT RAND(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'rand' +SELECT FROM_UNIXTIME(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'from_unixtime' +SELECT HOUR(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'hour' +SELECT YEAR(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'year' +SELECT RELEASE_LOCK(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +ERROR HY000: Illegal parameter data type uuid for operation 'release_lock' +SELECT JSON_LENGTH(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +JSON_LENGTH(CAST('00000000-0000-0000-0000-000000000000' AS UUID)) +1 +# +# Virtual columns +# +CREATE TABLE t1 ( +a INT, +b UUID GENERATED ALWAYS AS (CAST(CONCAT(RAND(),a) AS UUID)), INDEX(b) +); +ERROR HY000: Function or expression 'rand()' cannot be used in the GENERATED ALWAYS AS clause of `b` +CREATE TABLE t1 ( +a INT, +b UUID GENERATED ALWAYS AS (CAST(CONCAT('00000000-0000-0000-0000-00000000001',HEX(a)) AS UUID)), INDEX(b) +); +INSERT INTO t1 (a) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); +SELECT * FROM t1; +a b +0 00000000-0000-0000-0000-000000000010 +1 00000000-0000-0000-0000-000000000011 +2 00000000-0000-0000-0000-000000000012 +3 00000000-0000-0000-0000-000000000013 +4 00000000-0000-0000-0000-000000000014 +5 00000000-0000-0000-0000-000000000015 +6 00000000-0000-0000-0000-000000000016 +7 00000000-0000-0000-0000-000000000017 +8 00000000-0000-0000-0000-000000000018 +9 00000000-0000-0000-0000-000000000019 +10 00000000-0000-0000-0000-00000000001a +11 00000000-0000-0000-0000-00000000001b +12 00000000-0000-0000-0000-00000000001c +13 00000000-0000-0000-0000-00000000001d +14 00000000-0000-0000-0000-00000000001e +15 00000000-0000-0000-0000-00000000001f +DROP TABLE t1; +# +# VIEW +# +CREATE TABLE t1 (a INT DEFAULT 0); +INSERT INTO t1 (a) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); +SELECT * FROM t1 ORDER BY a; +a +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +CREATE VIEW v1 AS SELECT (CAST(CONCAT('00000000-0000-0000-0000-00000000001',HEX(a)) AS UUID)) AS c FROM t1; +SELECT * FROM v1 ORDER BY c; +c +00000000-0000-0000-0000-000000000010 +00000000-0000-0000-0000-000000000011 +00000000-0000-0000-0000-000000000012 +00000000-0000-0000-0000-000000000013 +00000000-0000-0000-0000-000000000014 +00000000-0000-0000-0000-000000000015 +00000000-0000-0000-0000-000000000016 +00000000-0000-0000-0000-000000000017 +00000000-0000-0000-0000-000000000018 +00000000-0000-0000-0000-000000000019 +00000000-0000-0000-0000-00000000001a +00000000-0000-0000-0000-00000000001b +00000000-0000-0000-0000-00000000001c +00000000-0000-0000-0000-00000000001d +00000000-0000-0000-0000-00000000001e +00000000-0000-0000-0000-00000000001f +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (a UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci +DESCRIBE v1; +Field Type Null Key Default Extra +a uuid YES 00000000-0000-0000-0000-000000000000 +INSERT INTO v1 VALUES +(DEFAULT), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (a UUID DEFAULT CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci +DESCRIBE v1; +Field Type Null Key Default Extra +a uuid YES cast('00000000-0000-0000-0000-000000000000' as uuid) +INSERT INTO v1 VALUES +(DEFAULT), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000000 +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +DROP VIEW v1; +DROP TABLE t1; +# +# Subqueries +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT * FROM t1 WHERE a=(SELECT MIN(a) FROM t1) ORDER BY a; +a +00000000-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE a=(SELECT MAX(a) FROM t1) ORDER BY a; +a +00000000-0000-0000-0000-000000000002 +SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a>'00000000-0000-0000-0000-000000000000') ORDER BY a; +a +00000000-0000-0000-0000-000000000001 +00000000-0000-0000-0000-000000000002 +DROP TABLE t1; +# +# Stored routines +# +CREATE PROCEDURE p1(a UUID) +BEGIN +DECLARE b UUID DEFAULT CONCAT('1',SUBSTRING(a,2,36)); +SELECT a, b; +END; +$$ +CALL p1('00000000-0000-0000-0000-000000000001'); +a b +00000000-0000-0000-0000-000000000001 10000000-0000-0000-0000-000000000001 +CALL p1(CAST('00000000-0000-0000-0000-000000000002' AS UUID)); +a b +00000000-0000-0000-0000-000000000002 10000000-0000-0000-0000-000000000002 +DROP PROCEDURE p1; +CREATE FUNCTION f1(a UUID) RETURNS UUID +BEGIN +RETURN CONCAT('1',SUBSTRING(a,2,36)); +END; +$$ +SELECT f1('00000000-0000-0000-0000-000000000001'); +f1('00000000-0000-0000-0000-000000000001') +10000000-0000-0000-0000-000000000001 +SELECT f1(CAST('00000000-0000-0000-0000-000000000002' AS UUID)); +f1(CAST('00000000-0000-0000-0000-000000000002' AS UUID)) +10000000-0000-0000-0000-000000000002 +DROP FUNCTION f1; +# +# Anchored data types in SP variables +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +CREATE PROCEDURE p1() +BEGIN +DECLARE va TYPE OF t1.a; +SELECT MAX(a) INTO va FROM t1; +SELECT va; +END; +$$ +CALL p1; +va +00000000-0000-0000-0000-000000000001 +DROP PROCEDURE p1; +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b UUID); +INSERT INTO t1 VALUES +( +'00000000-0000-0000-0000-00000000000a', +'00000000-0000-0000-0000-00000000000b' +); +CREATE PROCEDURE p1() +BEGIN +DECLARE va ROW TYPE OF t1; +SELECT MAX(a), MAX(b) INTO va FROM t1; +SELECT va.a, va.b; +END; +$$ +CALL p1; +va.a va.b +00000000-0000-0000-0000-00000000000a 00000000-0000-0000-0000-00000000000b +DROP PROCEDURE p1; +DROP TABLE t1; +# +# Optimizer: make_const_item_for_comparison +# +CREATE TABLE t1 (id INT, a UUID); +INSERT INTO t1 VALUES +(1,'00000000-0000-0000-0000-000000000001'), +(2,'00000000-0000-0000-0000-000000000002'); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID)) AND id>0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-000000000001' and `test`.`t1`.`id` > 0 +DROP TABLE t1; +# +# Optimizer: equal field propagation +# +CREATE TABLE t1 (id INT, a UUID); +INSERT INTO t1 VALUES +(1,'00000000-0000-0000-0000-000000000001'), +(2,'00000000-0000-0000-0000-000000000002'); +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID)) +AND LENGTH(CONCAT(a,RAND()))>1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-000000000001' and octet_length(concat(UUID'00000000-0000-0000-0000-000000000001',rand())) > 1 +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID)) +AND LENGTH(a)>1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-000000000001' +DROP TABLE t1; +# +# Optimizer: equal expression propagation +# +CREATE TABLE t1 (id INT, a UUID); +INSERT INTO t1 VALUES +(1,'00000000-0000-0000-0000-000000000001'), +(2,'00000000-0000-0000-0000-000000000002'); +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE COALESCE(a)='00000000-0000-0000-0000-000000000001' AND COALESCE(a)=CONCAT(a); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00000000-0000-0000-0000-000000000001' and concat(`test`.`t1`.`a`) = '00000000-0000-0000-0000-000000000001' +DROP TABLE t1; +# +# Subquery materialization +# +CREATE TABLE t1 (a UUID, b VARCHAR(36), KEY (a), KEY(b)) ; +INSERT INTO t1 VALUES +( +'00000000-0000-0000-0000-00000000000a', +'00000000-0000-0000-0000-00000000000a' +), +( +'00000000-0000-0000-0000-00000000000a', +'00000000-0000-0000-0000-00000000000b' +); +SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; +EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t1 index NULL a 17 NULL 2 Using index +EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t1 index_subquery a a 17 func 2 Using index; Using where +SET @@optimizer_switch=DEFAULT; +DROP TABLE t1; +# +# ALTER from UUID to UUID +# +CREATE TABLE t1 (a UUID, b INT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001', 1); +ALTER TABLE t1 MODIFY b DECIMAL(10,2); +SELECT * FROM t1; +a b +00000000-0000-0000-0000-000000000001 1.00 +DROP TABLE t1; +# +# ALTER to character string data types +# +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS CHAR(36)) FROM t1; +CAST(a AS CHAR(36)) +00000000-0000-0000-0000-000000000001 +ALTER TABLE t1 MODIFY a CHAR(39); +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a VARCHAR(36); +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a TINYTEXT; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a TEXT; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a MEDIUMTEXT; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a LONGTEXT; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +# +# ALTER from character string data types +# +CREATE OR REPLACE TABLE t1 (a CHAR(64)); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +CAST(a AS UUID) +00000000-0000-0000-0000-000000000001 +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +CAST(a AS UUID) +00000000-0000-0000-0000-000000000001 +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a TINYTEXT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +CAST(a AS UUID) +00000000-0000-0000-0000-000000000001 +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +CAST(a AS UUID) +00000000-0000-0000-0000-000000000001 +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a MEDIUMTEXT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +CAST(a AS UUID) +00000000-0000-0000-0000-000000000001 +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a LONGTEXT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +CAST(a AS UUID) +00000000-0000-0000-0000-000000000001 +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +# +# ALTER to binary string data types +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BINARY(16); +SELECT HEX(a) FROM t1; +HEX(a) +00000000000000000000000000000001 +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BINARY(17); +SELECT HEX(a) FROM t1; +HEX(a) +0000000000000000000000000000000100 +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BINARY(15); +ERROR 22001: Data too long for column 'a' at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a TINYBLOB; +SELECT HEX(a) FROM t1; +HEX(a) +00000000000000000000000000000001 +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BLOB; +SELECT HEX(a) FROM t1; +HEX(a) +00000000000000000000000000000001 +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a MEDIUMBLOB; +SELECT HEX(a) FROM t1; +HEX(a) +00000000000000000000000000000001 +DROP TABLE t1; +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a LONGBLOB; +SELECT HEX(a) FROM t1; +HEX(a) +00000000000000000000000000000001 +DROP TABLE t1; +# +# ALTER from binary string data types +# +CREATE TABLE t1 (a BINARY(16)); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +a +20010db8-0000-0000-0000-ff0000428329 +DROP TABLE t1; +CREATE TABLE t1 (a BINARY(17)); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF000042832900'); +ALTER TABLE t1 MODIFY a UUID; +ERROR 22007: Incorrect uuid value: ' \x01\x0D\xB8\x00\x00\x00\x00\x00\x00\xFF\x00\x00B\x83)\x00' for column `test`.`t1`.`a` at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a BINARY(15)); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF00004283'); +ALTER TABLE t1 MODIFY a UUID; +ERROR 22007: Incorrect uuid value: ' \x01\x0D\xB8\x00\x00\x00\x00\x00\x00\xFF\x00\x00B\x83' for column `test`.`t1`.`a` at row 1 +DROP TABLE t1; +CREATE TABLE t1 (a TINYBLOB); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +a +20010db8-0000-0000-0000-ff0000428329 +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +a +20010db8-0000-0000-0000-ff0000428329 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMBLOB); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +a +20010db8-0000-0000-0000-ff0000428329 +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +a +20010db8-0000-0000-0000-ff0000428329 +DROP TABLE t1; +# +# SET from UUID to UUID +# +CREATE TABLE t1 (a UUID, b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +# +# SET from UUID to numeric +# +CREATE TABLE t1 (a UUID, b INT); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b DOUBLE); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b DECIMAL(32,0)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b YEAR); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'uuid' as 'year' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +# +# SET from numeric to UUID +# +CREATE TABLE t1 (a INT, b UUID); +INSERT INTO t1 VALUES (1, NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE, b UUID); +INSERT INTO t1 VALUES (1, NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(32,0), b UUID); +INSERT INTO t1 VALUES (1, NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a YEAR, b UUID); +INSERT INTO t1 VALUES (1, NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'year' as 'uuid' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +# +# SET from UUID to temporal +# +CREATE TABLE t1 (a UUID, b TIME); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b DATE); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'uuid' as 'date' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b DATETIME); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'uuid' as 'datetime' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b TIMESTAMP NULL DEFAULT NULL); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'uuid' as 'timestamp' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +# +# SET from temporal to UUID +# +CREATE TABLE t1 (a TIME, b UUID); +INSERT INTO t1 VALUES ('00:00:00', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a DATE, b UUID); +INSERT INTO t1 VALUES ('2001-01:01', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'date' as 'uuid' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME, b UUID); +INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'datetime' as 'uuid' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP, b UUID); +INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); +UPDATE t1 SET b=a; +ERROR HY000: Cannot cast 'timestamp' as 'uuid' in assignment of `test`.`t1`.`b` +SELECT b FROM t1; +b +NULL +DROP TABLE t1; +# +# SET from UUID to character string +# +CREATE TABLE t1 (a UUID, b CHAR(39)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b VARCHAR(39)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b TEXT); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b ENUM('ffffffff-ffff-ffff-ffff-ffffffffffff')); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b SET('ffffffff-ffff-ffff-ffff-ffffffffffff')); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +# +# SET from character string to UUID +# +CREATE TABLE t1 (a CHAR(36), b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(36), b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +CREATE TABLE t1 (a TEXT, b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('ffffffff-ffff-ffff-ffff-ffffffffffff'), b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +CREATE TABLE t1 (a SET('ffffffff-ffff-ffff-ffff-ffffffffffff'), b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffffffff-ffff-ffff-ffff-ffffffffffff +DROP TABLE t1; +# +# SET from UUID to binary +# +CREATE TABLE t1 (a UUID, b BINARY(16)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT HEX(b) FROM t1; +HEX(b) +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b VARBINARY(39)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT HEX(b) FROM t1; +HEX(b) +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +DROP TABLE t1; +CREATE TABLE t1 (a UUID, b BLOB); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT HEX(b) FROM t1; +HEX(b) +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +DROP TABLE t1; +# +# SET from binary to UUID +# +CREATE TABLE t1 (a BINARY(16), b UUID); +INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffff0000-0000-0000-0000-00000000ffff +DROP TABLE t1; +CREATE TABLE t1 (a VARBINARY(16), b UUID); +INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffff0000-0000-0000-0000-00000000ffff +DROP TABLE t1; +CREATE TABLE t1 (a BLOB, b UUID); +INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +b +ffff0000-0000-0000-0000-00000000ffff +DROP TABLE t1; +# +# Limit clause parameter +# TODO: this should fail. +# The test for a valid data type should be moved +# from parse time to fix_fields() time, and performed +# for both Item_splocal and Item_param. +# +EXECUTE IMMEDIATE 'SELECT 1 FROM DUAL LIMIT ?' USING CAST('00000000-0000-0000-0000-000000000000' AS UUID); +1 +# +# ALTER from UUID to CHAR +# +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS CHAR(36)) FROM t1; +CAST(a AS CHAR(36)) +00000000-0000-0000-0000-000000000001 +ALTER TABLE t1 MODIFY a CHAR(36); +SELECT * FROM t1; +a +00000000-0000-0000-0000-000000000001 +DROP TABLE t1; +# +# ALTER from UUID to BINARY(16) +# +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BINARY(16); +SELECT HEX(a) FROM t1; +HEX(a) +00000000000000000000000000000001 +DROP TABLE t1; +# +# CAST(uuid AS BINARY) +# +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT HEX(CAST(a AS BINARY)) FROM t1; +HEX(CAST(a AS BINARY)) +00000000000000000000000000000001 +SELECT HEX(CAST(a AS BINARY(16))) FROM t1; +HEX(CAST(a AS BINARY(16))) +00000000000000000000000000000001 +DROP TABLE t1; +# +# CAST from UUID to FLOAT +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); +SELECT CAST(a AS FLOAT) FROM t1; +ERROR HY000: Illegal parameter data type uuid for operation 'float_typecast' +DROP TABLE t1; +# +# CAST(UUID AS BINARY) - metadata +# +CREATE TABLE t1 (a UUID); +SELECT +CAST(a AS BINARY(0)), +CAST(a AS BINARY(1)), +CAST(a AS BINARY(16)), +CAST(a AS BINARY(255)), +CAST(a AS BINARY(256)), +CAST(a AS BINARY(512)), +CAST(a AS BINARY(513)), +CAST(a AS BINARY(65532)), +CAST(a AS BINARY(65533)), +CAST(a AS BINARY(65534)), +CAST(a AS BINARY(65535)), +CAST(a AS BINARY(65536)), +CAST(a AS BINARY(16777215)), +CAST(a AS BINARY(16777216)) +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def CAST(a AS BINARY(0)) 254 0 0 Y 128 0 63 +def CAST(a AS BINARY(1)) 254 1 0 Y 128 0 63 +def CAST(a AS BINARY(16)) 254 16 0 Y 128 0 63 +def CAST(a AS BINARY(255)) 254 255 0 Y 128 0 63 +def CAST(a AS BINARY(256)) 253 256 0 Y 128 0 63 +def CAST(a AS BINARY(512)) 253 512 0 Y 128 0 63 +def CAST(a AS BINARY(513)) 253 513 0 Y 128 0 63 +def CAST(a AS BINARY(65532)) 253 65532 0 Y 128 0 63 +def CAST(a AS BINARY(65533)) 252 65533 0 Y 128 0 63 +def CAST(a AS BINARY(65534)) 252 65534 0 Y 128 0 63 +def CAST(a AS BINARY(65535)) 252 65535 0 Y 128 0 63 +def CAST(a AS BINARY(65536)) 250 65536 0 Y 128 0 63 +def CAST(a AS BINARY(16777215)) 250 16777215 0 Y 128 0 63 +def CAST(a AS BINARY(16777216)) 251 16777216 0 Y 128 0 63 +CAST(a AS BINARY(0)) CAST(a AS BINARY(1)) CAST(a AS BINARY(16)) CAST(a AS BINARY(255)) CAST(a AS BINARY(256)) CAST(a AS BINARY(512)) CAST(a AS BINARY(513)) CAST(a AS BINARY(65532)) CAST(a AS BINARY(65533)) CAST(a AS BINARY(65534)) CAST(a AS BINARY(65535)) CAST(a AS BINARY(65536)) CAST(a AS BINARY(16777215)) CAST(a AS BINARY(16777216)) +DROP TABLE t1; +# +# MIN(uuid) with GROUP BY +# +CREATE TABLE t1 (id INT, a UUID) ENGINE=MyISAM; +INSERT INTO t1 VALUES +(1, '00000000-0000-0000-0000-000000000fff'), +(1, '00000000-0000-0000-0000-000000008888'); +SELECT MIN(a), MAX(a) FROM t1 GROUP BY id; +MIN(a) MAX(a) +00000000-0000-0000-0000-000000000fff 00000000-0000-0000-0000-000000008888 +DROP TABLE t1; +# +# MDEV-26785 Hyphens inside the value of uuid datatype +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('0000000000000000000000000000000'/*31 digits*/); +ERROR 22007: Incorrect uuid value: '0000000000000000000000000000000' for column `test`.`t1`.`a` at row 1 +INSERT INTO t1 VALUES ('000000000000000000000000000000000'/*33 digits*/); +ERROR 22007: Incorrect uuid value: '000000000000000000000000000000000' for column `test`.`t1`.`a` at row 1 +INSERT INTO t1 VALUES ('-00000000000000000000000000000000'/*leading hyphen*/); +ERROR 22007: Incorrect uuid value: '-00000000000000000000000000000000' for column `test`.`t1`.`a` at row 1 +INSERT INTO t1 VALUES ('-00000000000000000000000000000000-'/*trailing hyphen*/); +ERROR 22007: Incorrect uuid value: '-00000000000000000000000000000000-' for column `test`.`t1`.`a` at row 1 +INSERT INTO t1 VALUES ('00000000000000000000000000000000'); +INSERT INTO t1 VALUES ('0-0000000000000000000000000000011'); +INSERT INTO t1 VALUES ('0--0000000000000000000000000000012'); +INSERT INTO t1 VALUES ('0---0000000000000000000000000000013'); +INSERT INTO t1 VALUES ('0----0000000000000000000000000000014'); +INSERT INTO t1 VALUES ('00-000000000000000000000000000021'); +INSERT INTO t1 VALUES ('00--000000000000000000000000000022'); +INSERT INTO t1 VALUES ('00---000000000000000000000000000023'); +INSERT INTO t1 VALUES ('00----000000000000000000000000000024'); +INSERT INTO t1 VALUES ('5796dac11a1c11--------------ecab4ef859-713e4be4'); +INSERT INTO t1 VALUES ('5796dac11a1c11---------------ecab4ef859-713e4be4'); +DROP TABLE t1; +# +# MDEV-26732 Assertion `0' failed in Item::val_native +# +SELECT uuid() AS f, var_pop('x') FROM dual HAVING f > ''; +f var_pop('x') +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'x' +Warning 1292 Incorrect uuid value: '' +# +# MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)" +# +CREATE TABLE companies (id uuid, name varchar(10)); +INSERT INTO companies (id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002'); +CREATE TABLE divisions (company_id uuid); +INSERT INTO divisions (company_id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002'); +SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions); +id name +7bc95b06-cc6c-11ec-96c5-0242ac130002 NULL +UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +id name +7bc95b06-cc6c-11ec-96c5-0242ac130002 value +DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +id name +DROP TABLE divisions; +DROP TABLE companies; +# +# MDEV-27100 Subquery using the ALL keyword on UUID columns produces a wrong result +# +CREATE TABLE t1 (d UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-111111111111'), ('11111111-0000-0000-0000-000000000000'); +SELECT * FROM t1 ORDER BY d; +d +00000000-0000-0000-0000-111111111111 +11111111-0000-0000-0000-000000000000 +SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1); +d +00000000-0000-0000-0000-111111111111 +SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1); +d +11111111-0000-0000-0000-000000000000 +DROP TABLE t1; +# +# MDEV-31719 Wrong result of: WHERE inet6_column IN ('','::1') +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); +SELECT * FROM t1 WHERE a IN ('','00000000-0000-0000-0000-000000000001'); +a +Warnings: +Warning 1292 Incorrect uuid value: '' +SELECT * FROM t1 WHERE a=''; +a +Warnings: +Warning 1292 Incorrect uuid value: '' +Warning 1292 Incorrect uuid value: '' +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test new file mode 100644 index 00000000..0979582a --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test @@ -0,0 +1,1695 @@ +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +--echo # +--echo # Basic CREATE functionality, defaults, metadata +--echo # + +--error ER_WRONG_FIELD_SPEC +CREATE TABLE t1 (a UUID AUTO_INCREMENT); + +CREATE TABLE t1 (a UUID); +SHOW CREATE TABLE t1; +DESCRIBE t1; +--vertical_results +--replace_column 19 # +SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND table_name='t1'; +--horizontal_results +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +--enable_metadata +SELECT * FROM t1; +SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID) AS a; +--disable_metadata +DROP TABLE t1; + + +CREATE TABLE t1 ( + c1 UUID DEFAULT 0x00000000000000000000000000000000, + c2 UUID DEFAULT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, + c3 UUID DEFAULT '00000000-0000-0000-0000-000000000000', + c4 UUID DEFAULT 'ffffffff-ffff-ffff-ffff-ffffffffffff', + c5 UUID DEFAULT CAST(X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' AS UUID) +); +SHOW CREATE TABLE t1; +DESCRIBE t1; +--vertical_results +--replace_column 19 # +SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='test' AND table_name='t1'; +--horizontal_results +DROP TABLE t1; + +--error ER_INVALID_DEFAULT +CREATE TABLE t1 (c1 UUID DEFAULT 0x00); +--error ER_INVALID_DEFAULT +CREATE TABLE t1 (c1 UUID DEFAULT ''); + + +CREATE TABLE t1 (a UUID); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('x'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t1 VALUES (1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t1 VALUES (TIME'10:20:30'); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES (0x00); +DROP TABLE t1; + +--echo # +--echo # CAST +--echo # + +SELECT CAST('garbage' AS UUID); +SELECT CAST(0x01 AS UUID); +SELECT CAST(REPEAT(0x00,16) AS UUID); +SELECT CAST(REPEAT(0x11,16) AS UUID); + +CREATE TABLE t1 AS SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID); +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # Text and binary formats, comparison operators +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES (0x00000000000000000000000000000000); +INSERT INTO t1 VALUES (0x00000000000000000000000000000001); +INSERT INTO t1 VALUES (0xFFFF0000000000000000000000000001); +INSERT INTO t1 VALUES (0xFFFF0000000000000000000000000002); +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t1 ORDER BY a DESC; +SELECT HEX(a),a FROM t1 ORDER BY a; +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000000'; +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000001'; +SELECT * FROM t1 WHERE a='ffff0000-0000-0000-0000-000000000001'; +SELECT * FROM t1 WHERE a='ffff0000-0000-0000-0000-000000000002'; +SELECT * FROM t1 WHERE a=0x00000000000000000000000000000000; +SELECT * FROM t1 WHERE a=0x00000000000000000000000000000001; +SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000001; +SELECT * FROM t1 WHERE a=0xffff0000000000000000000000000002; +SELECT * FROM t1 WHERE a< '00000000-0000-0000-0000-000000000000'; +SELECT * FROM t1 WHERE a<='00000000-0000-0000-0000-000000000000'; +SELECT * FROM t1 WHERE a>='ffff0000-0000-0000-0000-000000000002'; +SELECT * FROM t1 WHERE a> 'ffff0000-0000-0000-0000-000000000002'; +SELECT * FROM t1 WHERE a IN +( + '00000000-0000-0000-0000-000000000000', + 'ffff0000-0000-0000-0000-000000000001' +) ORDER BY a; +SELECT * FROM t1 WHERE a IN +( + '00000000-0000-0000-0000-000000000000', + 0xffff0000000000000000000000000002 +) ORDER BY a; + +SELECT * FROM t1 WHERE a<'garbage'; +SELECT * FROM t1 WHERE a<='garbage'; +SELECT * FROM t1 WHERE a='garbage'; +SELECT * FROM t1 WHERE a>='garbage'; +SELECT * FROM t1 WHERE a>'garbage'; + +SELECT * FROM t1 WHERE a<0x01; +SELECT * FROM t1 WHERE a<=0x01; +SELECT * FROM t1 WHERE a=0x01; +SELECT * FROM t1 WHERE a>=0x01; +SELECT * FROM t1 WHERE a>0x01; + +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-000000000000'; +SELECT * FROM t1 WHERE a='00-000000-0000-0000-0000-000000000000'; +SELECT * FROM t1 WHERE a='00-00-0000-0000-0000-0000-000000000000'; +SELECT * FROM t1 WHERE a='00-00-00-00-0000-0000-0000-000000000000'; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT * FROM t1 WHERE a=0; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT * FROM t1 WHERE a=0.0; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT * FROM t1 WHERE a=0e0; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT * FROM t1 WHERE a=TIME'10:20:30'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT * FROM t1 WHERE a IN ('::', 10); + +DROP TABLE t1; + +--echo # +--echo # ORDER BY +--echo # + +CREATE TABLE t1 (a UUID); +DELIMITER $$; +FOR i IN 0..15 +DO + INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +DELIMITER ;$$ + +--echo # +--echo # Logical ORDER BY +--echo # +SELECT * FROM t1 ORDER BY a; +SELECT COALESCE(NULL, a) FROM t1 ORDER BY a; + +--echo # +--echo # Lexicographical ORDER BY +--echo # + +SELECT * FROM t1 ORDER BY CAST(a AS BINARY(16)); +SELECT * FROM t1 ORDER BY CAST(COALESCE(NULL,a) AS BINARY(16)); + +DROP TABLE t1; + + +--echo # +--echo # cmp_item_uuid: IN for non-constants +--echo # + +CREATE TABLE t1 (a UUID, b UUID); +INSERT INTO t1 VALUES +( + '00000000-0000-0000-0000-000000000001', + '00000000-0000-0000-0000-000000000002' +); +SELECT * FROM t1 WHERE '00000000-0000-0000-0000-000000000000' IN (a, b); +SELECT * FROM t1 WHERE '00000000-0000-0000-0000-000000000001' IN (a, b); +SELECT * FROM t1 WHERE '00-000000-0000-0000-0000-000000000001' IN (a, b); +SELECT * FROM t1 WHERE '00-00-0000-0000-0000-0000-000000000001' IN (a, b); +DROP TABLE t1; + + +--echo # +--echo # cmp_item_uuid: DECODE_ORACLE +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +(NULL), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT a, DECODE_ORACLE(a, '00000000-0000-0000-0000-000000000002', '01') AS d FROM t1; +SELECT + a, + DECODE_ORACLE(a, '00000000-0000-0000-0000-000000000001', '01') AS d0, + DECODE_ORACLE(a, NULL, '<NULL>', '00000000-0000-0000-0000-000000000001', '01') AS d1, + DECODE_ORACLE(a, 'garbage', '<NULL>', '00000000-0000-0000-0000-000000000001', '01') AS d2 +FROM t1; +DROP TABLE t1; + + +--echo # +--echo # CASE abbreviations +--echo # + +CREATE TABLE t1 ( + c UUID, + c_char CHAR(32), + c_varchar VARCHAR(32), + c_tinytext TINYTEXT, + c_text TEXT, + c_mediumtext TEXT, + c_longtext LONGTEXT +); +CREATE TABLE t2 AS SELECT + COALESCE(c, c_char), + COALESCE(c, c_varchar), + COALESCE(c, c_tinytext), + COALESCE(c, c_text), + COALESCE(c, c_mediumtext), + COALESCE(c, c_longtext) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +CREATE TABLE t2 AS SELECT + LEAST(c, c_char), + LEAST(c, c_varchar), + LEAST(c, c_tinytext), + LEAST(c, c_text), + LEAST(c, c_mediumtext), + LEAST(c, c_longtext) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +(NULL), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); + +SELECT COALESCE(a, '00000000-0000-0000-0000-000000000000') FROM t1 ORDER BY a; + +SELECT + a, + LEAST(a,'00000000-0000-0000-0000-000000000000'), + LEAST(a,'00000000-0000-0000-0000-00000000000f') +FROM t1 ORDER BY a; + +SELECT + a, + GREATEST(a,'00000000-0000-0000-0000-000000000000'), + GREATEST(a,'00000000-0000-0000-0000-00000000000f') +FROM t1 ORDER BY a; + +CREATE TABLE t2 AS SELECT + COALESCE(a, '00000000-0000-0000-0000-000000000000'), + LEAST(a,'00000000-0000-0000-0000-000000000000'), + GREATEST(a,'00000000-0000-0000-0000-000000000000') +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +SELECT COALESCE(a, 0x00000000000000000000000000000000) FROM t1 ORDER BY a; +SELECT + a, + LEAST(a, 0x00000000000000000000000000000000), + LEAST(a, 0x0000000000000000000000000000000f) +FROM t1 ORDER BY a; + +SELECT + a, + GREATEST(a, 0x00000000000000000000000000000000), + GREATEST(a, 0x0000000000000000000000000000000f) +FROM t1 ORDER BY a; + +CREATE TABLE t2 AS SELECT + COALESCE(a, 0x00000000000000000000000000000000), + LEAST(a,0x00000000000000000000000000000000), + GREATEST(a,0x00000000000000000000000000000000) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a, 10) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT LEAST(a, 10) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT GREATEST(a, 10) FROM t1; + +DROP TABLE t1; + +SELECT COALESCE('garbage', CAST('::1' AS UUID)); +SELECT COALESCE(0x01, CAST('::1' AS UUID)); + + +--echo # +--echo # Uniqueness +--echo # + +CREATE TABLE t1 (a UUID NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES +('41000000-0000-0000-0000-000000000001'), +('61000000-0000-0000-0000-000000000001'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('41000000-0000-0000-0000-000000000001'); +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Indexes +--echo # + +--error ER_WRONG_SUB_KEY +CREATE TABLE t1 (a UUID, KEY(a(1))); + + +--echo # +--echo # Explicit CAST on INSERT +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000001' AS UUID)); +INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000002' AS UUID)); +INSERT INTO t1 VALUES (CAST('10000000-0000-0000-0000-000000000003' AS UUID)); +INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000001') AS UUID)); +INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000002') AS UUID)); +INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000003') AS UUID)); +SELECT * FROM t1 ORDER BY a; +DROP TABLE t1; + + +--echo # +--echo # Explicit CAST and implicit CAST on ALTER +--echo # + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('garbage'), +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('ffff0000-0000-0000-0000-000000000001'), +('ffff0000-0000-0000-0000-000000000002'); +SELECT a, CAST(a AS UUID) FROM t1 ORDER BY a; +SELECT a, CAST(a AS UUID) FROM t1 ORDER BY CAST(a AS UUID); +--error ER_TRUNCATED_WRONG_VALUE +ALTER TABLE t1 MODIFY a UUID; +SET sql_mode=''; +ALTER TABLE t1 MODIFY a UUID; +SET sql_mode=DEFAULT; +SELECT * FROM t1 ORDER BY a; +DROP TABLE t1; + + +CREATE TABLE t1 (a BINARY(16)); +INSERT INTO t1 VALUES (0x00000000000000000000000000000000); +INSERT INTO t1 VALUES (0x00000000000000000000000000000001); +INSERT INTO t1 VALUES (0xffff0000000000000000000000000001); +INSERT INTO t1 VALUES (0xffff0000000000000000000000000002); +SELECT HEX(a), CAST(a AS UUID) FROM t1 ORDER BY a; +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1 ORDER BY a; +DROP TABLE t1; + + +--echo # +--echo # INSERT..SELECT, same data types +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +CREATE TABLE t2 (a UUID); +INSERT INTO t2 SELECT a FROM t1; +SELECT * FROM t2; +DROP TABLE t1,t2; + + +--echo # +--echo # Implicit CAST on INSERT..SELECT, text format +--echo # + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('garbage'), +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('ffff0000-0000-0000-0000-000000000001'), +('ffff0000-0000-0000-0000-000000000002'); + +CREATE TABLE t2 (a UUID); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t2 SELECT a FROM t1; +SET sql_mode=''; +INSERT INTO t2 SELECT a FROM t1; +SELECT * FROM t2 ORDER BY a; +SET sql_mode=DEFAULT; +DROP TABLE t2; + +CREATE TABLE t2 (a UUID NOT NULL); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t2 SELECT a FROM t1; +SET sql_mode=''; +INSERT INTO t2 SELECT a FROM t1; +SELECT * FROM t2 ORDER BY a; +SET sql_mode=DEFAULT; +DROP TABLE t2; + +DROP TABLE t1; + + +--echo # +--echo # Implicit CAST on INSERT..SELECT, binary format +--echo # + +CREATE TABLE t1 (a BINARY(16)); +INSERT INTO t1 VALUES (0x00000000000000000000000000000000); +INSERT INTO t1 VALUES (0x00000000000000000000000000000001); +INSERT INTO t1 VALUES (0xffff0000000000000000000000000001); +INSERT INTO t1 VALUES (0xffff0000000000000000000000000002); +CREATE TABLE t2 (a UUID); +INSERT INTO t2 SELECT a FROM t1; +SELECT a FROM t2 ORDER BY a; +DROP TABLE t1,t2; + + +--echo # +--echo # CAST to other data types +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DOUBLE); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS FLOAT); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DECIMAL); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS SIGNED); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS UNSIGNED); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS TIME); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DATE); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS DATETIME); + +SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR); +CREATE TABLE t1 AS SELECT CAST(CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS CHAR) AS a; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); +CREATE TABLE t2 AS SELECT + CAST(a AS CHAR), + CAST(a AS CHAR(36)), + CAST(a AS CHAR(530)), + CAST(a AS CHAR(65535)), + CAST(a AS CHAR(66000)), + CAST(a AS CHAR(16777215)), + CAST(a AS CHAR(16777216)) +FROM t1; +SHOW CREATE TABLE t2; +--vertical_results +SELECT * FROM t2; +--horizontal_results +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'); +CREATE TABLE t2 AS SELECT + CAST(a AS BINARY(4)) AS cb4, + CAST(a AS BINARY) AS cb, + CAST(a AS BINARY(16)) AS cb16, + CAST(a AS BINARY(32)) AS cb32, + CAST(a AS BINARY(530)) AS cb530, + CAST(a AS BINARY(65535)) AS cb65535, + CAST(a AS BINARY(66000)) AS cb66000, + CAST(a AS BINARY(16777215)) AS cb16777215, + CAST(a AS BINARY(16777216)) AS cb16777216 +FROM t1 LIMIT 0; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE TABLE t2 AS SELECT + CAST(a AS BINARY(4)) AS cb4, + CAST(a AS BINARY) AS cb, + CAST(a AS BINARY(16)) AS cb16, + CAST(a AS BINARY(32)) AS cb32, + CAST(a AS BINARY(530)) AS cb530, + CAST(a AS BINARY(65535)) AS cb65535 +FROM t1; +SHOW CREATE TABLE t2; +--vertical_results +SELECT + HEX(cb4), + HEX(cb), + HEX(cb16), + HEX(cb32), + LENGTH(cb530), + LENGTH(cb65535) +FROM t2; +--horizontal_results +DROP TABLE t2; +DROP TABLE t1; + +--echo # +--echo # Implicit conversion to other types in INSERT +--echo # + +CREATE TABLE t1 (a INT); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(32,0)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +DROP TABLE t1; + +CREATE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES (CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +DROP TABLE t1; + + + +--echo # +--echo # Boolean context +--echo # + +SELECT + CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS TRUE, + CAST('00000000-0000-0000-0000-000000000000' AS UUID) IS FALSE, + CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS TRUE, + CAST('00000000-0000-0000-0000-000000000001' AS UUID) IS FALSE; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'); +SELECT a, a IS TRUE, a IS FALSE FROM t1 ORDER BY a; +DROP TABLE t1; + +# +# TODO: Error looks like a bug. This should return rows where a<>'00000000-0000-0000-0000-000000000000'. +# The same problem is repeatable with GEOMETRY. +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT * FROM t1 WHERE a; +DROP TABLE t1; + + +--echo # +--echo # GROUP BY +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-0000-00000000'); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-0000-00000001'), +('00000000-0000-0000-0000-0000-0000-0001'); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-0000-00000002'), +('00000000-0000-0000-0000-0000-0000-0002'); +SELECT a, COUNT(*) FROM t1 GROUP BY a; +DROP TABLE t1; + +--echo # +--echo # Aggregate functions +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000000'); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-0000-00000001'), +('00000000-0000-0000-0000-0000-0000-0001'); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000002'); +SELECT MIN(a),MAX(a) FROM t1; + +CREATE TABLE t2 AS SELECT MIN(a), MAX(a) FROM t1; +SHOW CREATE TABLE t2; +SELECT * FROM t2; +DROP TABLE t2; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT AVG(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT AVG(DISTINCT a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SUM(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SUM(DISTINCT a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT STDDEV(a) FROM t1; +SELECT GROUP_CONCAT(a ORDER BY a) FROM t1; +SELECT a, GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a; +DROP TABLE t1; + +--echo # +--echo # Window functions +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'), +('00000000-0000-0000-0000-000000000003'), +('00000000-0000-0000-0000-000000000004'); +SELECT + a, + LAG(a) OVER (ORDER BY a), + LEAD(a) OVER (ORDER BY a) +FROM t1 ORDER BY a; + +SELECT + a, + FIRST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + LAST_VALUE(a) OVER (ORDER BY a ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +FROM t1 ORDER BY a; +DROP TABLE t1; + + +--echo # +--echo # Prepared statements +--echo # + +EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ? AS a' + USING CAST('00000000-0000-0000-0000-000000000000' AS UUID); +SHOW CREATE TABLE t1; + +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' + USING '00000000-0000-0000-0000-000000000001'; + +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' + USING CAST('00000000-0000-0000-0000-000000000002' AS UUID); + +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?)' + USING 0x00000000000000000000000000000003; + +SELECT a FROM t1 ORDER BY a; +EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' + USING '00000000-0000-0000-0000-000000000001'; + +EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' + USING CAST('00000000-0000-0000-0000-000000000002' AS UUID); + +EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE a=?' + USING 0x00000000000000000000000000000003; +DROP TABLE t1; + + +--echo # +--echo # Character set and collation aggregation +--echo # + +CREATE TABLE t1 (a UUID); + +CREATE TABLE t2 AS SELECT + CONCAT(a) AS c1, + CONCAT(CAST('00000000-0000-0000-0000-000000000000' AS UUID)) AS c2 +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE TABLE t2 AS SELECT + CONCAT(_utf8'1', LEFT(a,35)) AS c1, + CONCAT(_utf8'1', LEFT(CAST('00000000-0000-0000-0000-000000000000' AS UUID),35)) AS c2, + CONCAT(_utf8'1', LEFT(COALESCE(a),35)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE TABLE t2 AS SELECT + CONCAT(_latin1'1', LEFT(a,35)) AS c1, + CONCAT(_latin1'1', LEFT(CAST('00000000-0000-0000-0000-000000000000' AS UUID),35)) AS c2, + CONCAT(_latin1'1', LEFT(COALESCE(a),35)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +DROP TABLE t1; + + +--echo # +--echo # UNION +--echo # + +CREATE TABLE t1 AS + SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c + UNION + SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID); +SHOW CREATE TABLE t1; +SELECT * FROM t1 ORDER BY c; +DROP TABLE t1; + +CREATE TABLE t1 AS + SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c + UNION + SELECT '00000000-0000-0000-0000-000000000001'; +SHOW CREATE TABLE t1; +SELECT * FROM t1 ORDER BY c; +DROP TABLE t1; + +CREATE TABLE t1 AS + SELECT '00000000-0000-0000-0000-000000000000' AS c + UNION + SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID); +SHOW CREATE TABLE t1; +SELECT * FROM t1 ORDER BY c; +DROP TABLE t1; + +CREATE TABLE t1 AS + SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c + UNION + SELECT 0x00000000000000000000000000000001; +SHOW CREATE TABLE t1; +SELECT * FROM t1 ORDER BY c; +DROP TABLE t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +CREATE TABLE t1 AS + SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) AS c + UNION + SELECT 1; + + +--echo # +--echo # Unary operators +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT -CAST('00000000-0000-0000-0000-000000000000' AS UUID); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ABS(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ROUND(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CEILING(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT FLOOR(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + + +--echo # +--echo # Arithmetic operators +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) + 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) - 1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) * 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) / 1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) MOD 1; + + +--echo # +--echo # Misc +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT RAND(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT FROM_UNIXTIME(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT HOUR(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT YEAR(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT RELEASE_LOCK(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +SELECT JSON_LENGTH(CAST('00000000-0000-0000-0000-000000000000' AS UUID)); + +--echo # +--echo # Virtual columns +--echo # + +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +CREATE TABLE t1 ( + a INT, + b UUID GENERATED ALWAYS AS (CAST(CONCAT(RAND(),a) AS UUID)), INDEX(b) +); + +CREATE TABLE t1 ( + a INT, + b UUID GENERATED ALWAYS AS (CAST(CONCAT('00000000-0000-0000-0000-00000000001',HEX(a)) AS UUID)), INDEX(b) +); +INSERT INTO t1 (a) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # VIEW +--echo # + +CREATE TABLE t1 (a INT DEFAULT 0); +INSERT INTO t1 (a) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); +SELECT * FROM t1 ORDER BY a; +CREATE VIEW v1 AS SELECT (CAST(CONCAT('00000000-0000-0000-0000-00000000001',HEX(a)) AS UUID)) AS c FROM t1; +SELECT * FROM v1 ORDER BY c; +DROP VIEW v1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +DESCRIBE v1; +INSERT INTO v1 VALUES +(DEFAULT), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT * FROM t1; +DROP VIEW v1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID DEFAULT CAST('00000000-0000-0000-0000-000000000000' AS UUID)); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +DESCRIBE v1; +INSERT INTO v1 VALUES +(DEFAULT), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT * FROM t1; +DROP VIEW v1; +DROP TABLE t1; + + +--echo # +--echo # Subqueries +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('00000000-0000-0000-0000-000000000000'), +('00000000-0000-0000-0000-000000000001'), +('00000000-0000-0000-0000-000000000002'); +SELECT * FROM t1 WHERE a=(SELECT MIN(a) FROM t1) ORDER BY a; +SELECT * FROM t1 WHERE a=(SELECT MAX(a) FROM t1) ORDER BY a; +SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a>'00000000-0000-0000-0000-000000000000') ORDER BY a; +DROP TABLE t1; + +--echo # +--echo # Stored routines +--echo # + +DELIMITER $$; +CREATE PROCEDURE p1(a UUID) +BEGIN + DECLARE b UUID DEFAULT CONCAT('1',SUBSTRING(a,2,36)); + SELECT a, b; +END; +$$ +DELIMITER ;$$ +CALL p1('00000000-0000-0000-0000-000000000001'); +CALL p1(CAST('00000000-0000-0000-0000-000000000002' AS UUID)); +DROP PROCEDURE p1; + +DELIMITER $$; +CREATE FUNCTION f1(a UUID) RETURNS UUID +BEGIN + RETURN CONCAT('1',SUBSTRING(a,2,36)); +END; +$$ +DELIMITER ;$$ +SELECT f1('00000000-0000-0000-0000-000000000001'); +SELECT f1(CAST('00000000-0000-0000-0000-000000000002' AS UUID)); +DROP FUNCTION f1; + +--echo # +--echo # Anchored data types in SP variables +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE va TYPE OF t1.a; + SELECT MAX(a) INTO va FROM t1; + SELECT va; +END; +$$ +DELIMITER ;$$ +CALL p1; +DROP PROCEDURE p1; +DROP TABLE t1; + + +CREATE TABLE t1 (a UUID, b UUID); +INSERT INTO t1 VALUES +( + '00000000-0000-0000-0000-00000000000a', + '00000000-0000-0000-0000-00000000000b' +); +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE va ROW TYPE OF t1; + SELECT MAX(a), MAX(b) INTO va FROM t1; + SELECT va.a, va.b; +END; +$$ +DELIMITER ;$$ +CALL p1; +DROP PROCEDURE p1; +DROP TABLE t1; + + +--echo # +--echo # Optimizer: make_const_item_for_comparison +--echo # + +CREATE TABLE t1 (id INT, a UUID); +INSERT INTO t1 VALUES +(1,'00000000-0000-0000-0000-000000000001'), +(2,'00000000-0000-0000-0000-000000000002'); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID)) AND id>0; +DROP TABLE t1; + +--echo # +--echo # Optimizer: equal field propagation +--echo # + +CREATE TABLE t1 (id INT, a UUID); +INSERT INTO t1 VALUES +(1,'00000000-0000-0000-0000-000000000001'), +(2,'00000000-0000-0000-0000-000000000002'); +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID)) + AND LENGTH(CONCAT(a,RAND()))>1; +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE a=COALESCE(CAST('00000000-0000-0000-0000-000000000001' AS UUID)) + AND LENGTH(a)>1; +DROP TABLE t1; + + +--echo # +--echo # Optimizer: equal expression propagation +--echo # + + +CREATE TABLE t1 (id INT, a UUID); +INSERT INTO t1 VALUES +(1,'00000000-0000-0000-0000-000000000001'), +(2,'00000000-0000-0000-0000-000000000002'); +EXPLAIN EXTENDED SELECT * FROM t1 +WHERE COALESCE(a)='00000000-0000-0000-0000-000000000001' AND COALESCE(a)=CONCAT(a); +DROP TABLE t1; + +--echo # +--echo # Subquery materialization +--echo # + +CREATE TABLE t1 (a UUID, b VARCHAR(36), KEY (a), KEY(b)) ; +INSERT INTO t1 VALUES +( + '00000000-0000-0000-0000-00000000000a', + '00000000-0000-0000-0000-00000000000a' +), +( + '00000000-0000-0000-0000-00000000000a', + '00000000-0000-0000-0000-00000000000b' +); +SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; +EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner); +EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner); +SET @@optimizer_switch=DEFAULT; +DROP TABLE t1; + + +--echo # +--echo # ALTER from UUID to UUID +--echo # + +CREATE TABLE t1 (a UUID, b INT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001', 1); +ALTER TABLE t1 MODIFY b DECIMAL(10,2); +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # ALTER to character string data types +--echo # + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS CHAR(36)) FROM t1; +ALTER TABLE t1 MODIFY a CHAR(39); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a VARCHAR(36); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a TINYTEXT; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a TEXT; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a MEDIUMTEXT; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a LONGTEXT; +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # ALTER from character string data types +--echo # + +CREATE OR REPLACE TABLE t1 (a CHAR(64)); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a TINYTEXT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a MEDIUMTEXT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (a LONGTEXT); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS UUID) FROM t1; +ALTER TABLE t1 MODIFY a UUID; +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # ALTER to binary string data types +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BINARY(16); +SELECT HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BINARY(17); +SELECT HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +--error ER_DATA_TOO_LONG +ALTER TABLE t1 MODIFY a BINARY(15); +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a TINYBLOB; +SELECT HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BLOB; +SELECT HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a MEDIUMBLOB; +SELECT HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a LONGBLOB; +SELECT HEX(a) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # ALTER from binary string data types +--echo # + +CREATE TABLE t1 (a BINARY(16)); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BINARY(17)); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF000042832900'); +--error ER_TRUNCATED_WRONG_VALUE +ALTER TABLE t1 MODIFY a UUID; +DROP TABLE t1; + +CREATE TABLE t1 (a BINARY(15)); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF00004283'); +--error ER_TRUNCATED_WRONG_VALUE +ALTER TABLE t1 MODIFY a UUID; +DROP TABLE t1; + +CREATE TABLE t1 (a TINYBLOB); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a MEDIUMBLOB); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (X'20010DB8000000000000FF0000428329'); +ALTER TABLE t1 MODIFY a UUID; +SELECT a FROM t1; +DROP TABLE t1; + + +--echo # +--echo # SET from UUID to UUID +--echo # + +CREATE TABLE t1 (a UUID, b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +--echo # +--echo # SET from UUID to numeric +--echo # + +CREATE TABLE t1 (a UUID, b INT); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b DOUBLE); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b DECIMAL(32,0)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b YEAR); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + + +--echo # +--echo # SET from numeric to UUID +--echo # + +CREATE TABLE t1 (a INT, b UUID); +INSERT INTO t1 VALUES (1, NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE, b UUID); +INSERT INTO t1 VALUES (1, NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(32,0), b UUID); +INSERT INTO t1 VALUES (1, NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a YEAR, b UUID); +INSERT INTO t1 VALUES (1, NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + + +--echo # +--echo # SET from UUID to temporal +--echo # + +CREATE TABLE t1 (a UUID, b TIME); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b DATE); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b DATETIME); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b TIMESTAMP NULL DEFAULT NULL); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + + +--echo # +--echo # SET from temporal to UUID +--echo # + +CREATE TABLE t1 (a TIME, b UUID); +INSERT INTO t1 VALUES ('00:00:00', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DATE, b UUID); +INSERT INTO t1 VALUES ('2001-01:01', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DATETIME, b UUID); +INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIMESTAMP, b UUID); +INSERT INTO t1 VALUES ('2001-01-01 10:20:30', NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + + +--echo # +--echo # SET from UUID to character string +--echo # + +CREATE TABLE t1 (a UUID, b CHAR(39)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b VARCHAR(39)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b TEXT); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b ENUM('ffffffff-ffff-ffff-ffff-ffffffffffff')); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b SET('ffffffff-ffff-ffff-ffff-ffffffffffff')); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + + +--echo # +--echo # SET from character string to UUID +--echo # + +CREATE TABLE t1 (a CHAR(36), b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(36), b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TEXT, b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a ENUM('ffffffff-ffff-ffff-ffff-ffffffffffff'), b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a SET('ffffffff-ffff-ffff-ffff-ffffffffffff'), b UUID); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + + +--echo # +--echo # SET from UUID to binary +--echo # + +CREATE TABLE t1 (a UUID, b BINARY(16)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT HEX(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b VARBINARY(39)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT HEX(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a UUID, b BLOB); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff', NULL); +UPDATE t1 SET b=a; +SELECT HEX(b) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # SET from binary to UUID +--echo # + +CREATE TABLE t1 (a BINARY(16), b UUID); +INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARBINARY(16), b UUID); +INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BLOB, b UUID); +INSERT INTO t1 VALUES (CONCAT(0xFFFF,REPEAT(0x0000,6),0xFFFF), NULL); +UPDATE t1 SET b=a; +SELECT b FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Limit clause parameter +--echo # TODO: this should fail. +--echo # The test for a valid data type should be moved +--echo # from parse time to fix_fields() time, and performed +--echo # for both Item_splocal and Item_param. +--echo # + +EXECUTE IMMEDIATE 'SELECT 1 FROM DUAL LIMIT ?' USING CAST('00000000-0000-0000-0000-000000000000' AS UUID); + + +# TODO: +# - Add hooks to run mysql_client_test with pluggable data types +# +# - This should fail with the "illegal data type" error: +#SELECT CAST('00000000-0000-0000-0000-000000000000' AS UUID) DIV 1; +# +# - This should fail with the "illegal data type" error: +# EXTRACT(MINUTE...) +# + + +--echo # +--echo # ALTER from UUID to CHAR +--echo # + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT CAST(a AS CHAR(36)) FROM t1; +ALTER TABLE t1 MODIFY a CHAR(36); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # ALTER from UUID to BINARY(16) +--echo # + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +ALTER TABLE t1 MODIFY a BINARY(16); +SELECT HEX(a) FROM t1; +DROP TABLE t1; + +--echo # +--echo # CAST(uuid AS BINARY) +--echo # + +CREATE OR REPLACE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +SELECT HEX(CAST(a AS BINARY)) FROM t1; +SELECT HEX(CAST(a AS BINARY(16))) FROM t1; +DROP TABLE t1; + +--echo # +--echo # CAST from UUID to FLOAT +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS FLOAT) FROM t1; +DROP TABLE t1; + +# TODO: below does not work well +#--echo # +#--echo # Conversion from UUID to other types +#--echo # +# +#CREATE TABLE t1 (a UUID, b INT); +#INSERT INTO t1 (a) VALUES ('00000000-0000-0000-0000-000000000000'); +#--error WARN_DATA_TRUNCATED +#UPDATE t1 SET b=a; +#SELECT * FROM t1; +#DROP TABLE t1; +# +#SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); +#CREATE TABLE t1 (a UUID, b TIMESTAMP); +#INSERT INTO t1 (a) VALUES ('00000000-0000-0000-0000-000000000000'); +#--error WARN_DATA_TRUNCATED +#UPDATE t1 SET b=a; +#SELECT * FROM t1; +#DROP TABLE t1; +#SET timestamp=DEFAULT; +# +#CREATE OR REPLACE TABLE t1 (a UUID); +#INSERT INTO t1 (a) VALUES ('00000000-0000-0000-0000-000000000000'); +#--error WARN_DATA_TRUNCATED +#ALTER TABLE t1 MODIFY a DATE; +#DROP TABLE t1; + +--echo # +--echo # CAST(UUID AS BINARY) - metadata +--echo # + +CREATE TABLE t1 (a UUID); +--enable_metadata +SELECT + CAST(a AS BINARY(0)), + CAST(a AS BINARY(1)), + CAST(a AS BINARY(16)), + CAST(a AS BINARY(255)), + CAST(a AS BINARY(256)), + CAST(a AS BINARY(512)), + CAST(a AS BINARY(513)), + CAST(a AS BINARY(65532)), + CAST(a AS BINARY(65533)), + CAST(a AS BINARY(65534)), + CAST(a AS BINARY(65535)), + CAST(a AS BINARY(65536)), + CAST(a AS BINARY(16777215)), + CAST(a AS BINARY(16777216)) +FROM t1; +--disable_metadata +DROP TABLE t1; + +--echo # +--echo # MIN(uuid) with GROUP BY +--echo # + +CREATE TABLE t1 (id INT, a UUID) ENGINE=MyISAM; +INSERT INTO t1 VALUES +(1, '00000000-0000-0000-0000-000000000fff'), +(1, '00000000-0000-0000-0000-000000008888'); +SELECT MIN(a), MAX(a) FROM t1 GROUP BY id; +DROP TABLE t1; + + +--echo # +--echo # MDEV-26785 Hyphens inside the value of uuid datatype +--echo # + +CREATE TABLE t1 (a UUID); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('0000000000000000000000000000000'/*31 digits*/); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('000000000000000000000000000000000'/*33 digits*/); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('-00000000000000000000000000000000'/*leading hyphen*/); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('-00000000000000000000000000000000-'/*trailing hyphen*/); + +INSERT INTO t1 VALUES ('00000000000000000000000000000000'); +INSERT INTO t1 VALUES ('0-0000000000000000000000000000011'); +INSERT INTO t1 VALUES ('0--0000000000000000000000000000012'); +INSERT INTO t1 VALUES ('0---0000000000000000000000000000013'); +INSERT INTO t1 VALUES ('0----0000000000000000000000000000014'); +INSERT INTO t1 VALUES ('00-000000000000000000000000000021'); +INSERT INTO t1 VALUES ('00--000000000000000000000000000022'); +INSERT INTO t1 VALUES ('00---000000000000000000000000000023'); +INSERT INTO t1 VALUES ('00----000000000000000000000000000024'); + +INSERT INTO t1 VALUES ('5796dac11a1c11--------------ecab4ef859-713e4be4'); +INSERT INTO t1 VALUES ('5796dac11a1c11---------------ecab4ef859-713e4be4'); +DROP TABLE t1; + +--echo # +--echo # MDEV-26732 Assertion `0' failed in Item::val_native +--echo # + +SELECT uuid() AS f, var_pop('x') FROM dual HAVING f > ''; + + +--echo # +--echo # MDEV-28491 Uuid. "UPDATE/DELETE" not working "WHERE id IN (SELECT id FROM ..)" +--echo # + +CREATE TABLE companies (id uuid, name varchar(10)); +INSERT INTO companies (id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002'); + +CREATE TABLE divisions (company_id uuid); +INSERT INTO divisions (company_id) values ('7bc95b06-cc6c-11ec-96c5-0242ac130002'); +SELECT * FROM companies WHERE id IN (SELECT company_id FROM divisions); +UPDATE companies SET name = 'value' WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions); +SELECT * FROM companies; +DROP TABLE divisions; +DROP TABLE companies; + + +--echo # +--echo # MDEV-27100 Subquery using the ALL keyword on UUID columns produces a wrong result +--echo # + +CREATE TABLE t1 (d UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-111111111111'), ('11111111-0000-0000-0000-000000000000'); +SELECT * FROM t1 ORDER BY d; +SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1); +SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1); +DROP TABLE t1; + + +--echo # +--echo # MDEV-31719 Wrong result of: WHERE inet6_column IN ('','::1') +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000'); +SELECT * FROM t1 WHERE a IN ('','00000000-0000-0000-0000-000000000001'); +SELECT * FROM t1 WHERE a=''; +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result new file mode 100644 index 00000000..d912244e --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.result @@ -0,0 +1,92 @@ +# +# Start of 10.5 tests +# +# +# MDEV-4958 Adding datatype UUID +# +SET default_storage_engine=CSV; +CREATE TABLE t1 (a UUID NOT NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid NOT NULL +) ENGINE=CSV DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00,15), UNHEX(HEX(i)))); +END FOR +$$ +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +a +00000000-0000-0000-0000-0000000000ff +SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe' ORDER BY a; +a +00000000-0000-0000-0000-0000000000fe +00000000-0000-0000-0000-0000000000ff +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'00000000-0000-0000-0000-0000000000ff' +) +ORDER BY a; +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-0000000000a0 +00000000-0000-0000-0000-0000000000ff +SELECT * FROM t1 +WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' + AND +'00000000-0000-0000-0000-000000000081' +ORDER BY a; +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-000000000081 +SELECT CONCAT('ffff',SUBSTRING(a, 5,256)) FROM t1 WHERE a LIKE '%a_'; +CONCAT('ffff',SUBSTRING(a, 5,256)) +ffff0000-0000-0000-0000-0000000000a0 +ffff0000-0000-0000-0000-0000000000a1 +ffff0000-0000-0000-0000-0000000000a2 +ffff0000-0000-0000-0000-0000000000a3 +ffff0000-0000-0000-0000-0000000000a4 +ffff0000-0000-0000-0000-0000000000a5 +ffff0000-0000-0000-0000-0000000000a6 +ffff0000-0000-0000-0000-0000000000a7 +ffff0000-0000-0000-0000-0000000000a8 +ffff0000-0000-0000-0000-0000000000a9 +ffff0000-0000-0000-0000-0000000000aa +ffff0000-0000-0000-0000-0000000000ab +ffff0000-0000-0000-0000-0000000000ac +ffff0000-0000-0000-0000-0000000000ad +ffff0000-0000-0000-0000-0000000000ae +ffff0000-0000-0000-0000-0000000000af +UPDATE t1 SET a=CONCAT('ffff',SUBSTRING(a, 5,256)) WHERE a LIKE '%a_'; +SELECT * FROM t1 WHERE a LIKE 'ffff%' ORDER BY a; +a +ffff0000-0000-0000-0000-0000000000a0 +ffff0000-0000-0000-0000-0000000000a1 +ffff0000-0000-0000-0000-0000000000a2 +ffff0000-0000-0000-0000-0000000000a3 +ffff0000-0000-0000-0000-0000000000a4 +ffff0000-0000-0000-0000-0000000000a5 +ffff0000-0000-0000-0000-0000000000a6 +ffff0000-0000-0000-0000-0000000000a7 +ffff0000-0000-0000-0000-0000000000a8 +ffff0000-0000-0000-0000-0000000000a9 +ffff0000-0000-0000-0000-0000000000aa +ffff0000-0000-0000-0000-0000000000ab +ffff0000-0000-0000-0000-0000000000ac +ffff0000-0000-0000-0000-0000000000ad +ffff0000-0000-0000-0000-0000000000ae +ffff0000-0000-0000-0000-0000000000af +DROP TABLE t1; +CREATE TABLE t1 (a UUID NOT NULL) ENGINE=CSV; +INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440000'); +SELECT * FROM t1; +a +123e4567-e89b-12d3-a456-426655440000 +DROP TABLE t1; +# +# End of 10.5 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.test new file mode 100644 index 00000000..482fb6a0 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_csv.test @@ -0,0 +1,58 @@ +--source include/have_csv.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +SET default_storage_engine=CSV; + +CREATE TABLE t1 (a UUID NOT NULL); +SHOW CREATE TABLE t1; + +DELIMITER $$; +FOR i IN 0..255 +DO + INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00,15), UNHEX(HEX(i)))); +END FOR +$$ +DELIMITER ;$$ + +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; + +SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe' ORDER BY a; + +SELECT * FROM t1 WHERE a IN +( + '00000000-0000-0000-0000-000000000080', + '00000000-0000-0000-0000-0000000000a0', + '00000000-0000-0000-0000-0000000000ff' +) +ORDER BY a; + +SELECT * FROM t1 +WHERE a BETWEEN + '00000000-0000-0000-0000-000000000080' + AND + '00000000-0000-0000-0000-000000000081' +ORDER BY a; + +SELECT CONCAT('ffff',SUBSTRING(a, 5,256)) FROM t1 WHERE a LIKE '%a_'; +UPDATE t1 SET a=CONCAT('ffff',SUBSTRING(a, 5,256)) WHERE a LIKE '%a_'; + +SELECT * FROM t1 WHERE a LIKE 'ffff%' ORDER BY a; + +DROP TABLE t1; + +CREATE TABLE t1 (a UUID NOT NULL) ENGINE=CSV; +INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440000'); +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc new file mode 100644 index 00000000..41494c86 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_engines.inc @@ -0,0 +1,108 @@ +--echo # +--echo # Range optimizer +--echo # + +CREATE TABLE t1 (a UUID, INDEX(a)); +SHOW CREATE TABLE t1; + +DELIMITER $$; +FOR i IN 0..255 +DO + INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY))); +END FOR +$$ +DELIMITER ;$$ + +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +SELECT * FROM t1 WHERE a='garbage'; +EXPLAIN SELECT * FROM t1 WHERE a='garbage'; + +SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; +EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; +SELECT * FROM t1 WHERE a>='garbage'; +EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; + +SELECT * FROM t1 WHERE a IN +( + '00000000-0000-0000-0000-000000000080', + '00000000-0000-0000-0000-0000000000a0', + '00000000-0000-0000-0000-0000000000f0' +); +EXPLAIN SELECT * FROM t1 WHERE a IN +( + '00000000-0000-0000-0000-000000000080', + '00000000-0000-0000-0000-0000000000a0', + '00000000-0000-0000-0000-0000000000f0' +); +SELECT * FROM t1 WHERE a IN +( + '00000000-0000-0000-0000-000000000080', + '00000000-0000-0000-0000-0000000000a0', + 'garbage' +); +EXPLAIN SELECT * FROM t1 WHERE a IN +( + '00000000-0000-0000-0000-000000000080', + '00000000-0000-0000-0000-0000000000a0', + 'garbage' +); + +SELECT * FROM t1 WHERE a BETWEEN + '00000000-0000-0000-0000-000000000080' AND + '00000000-0000-0000-0000-000000000081'; +EXPLAIN SELECT * FROM t1 WHERE a BETWEEN + '00000000-0000-0000-0000-000000000080' AND + '00000000-0000-0000-0000-000000000081'; + +SELECT * FROM t1 WHERE a BETWEEN + '00000000-0000-0000-0000-000000000080' AND + 'garbage'; +EXPLAIN SELECT * FROM t1 WHERE a BETWEEN + '00000000-0000-0000-0000-000000000080' AND + 'garbage'; + +SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); + +DROP TABLE t1; + + +CREATE OR REPLACE TABLE t1 (a UUID,KEY(a)); +SHOW CREATE TABLE t1; +BEGIN; +DELIMITER $$; +FOR i IN 0..255 +DO + INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +DELIMITER ;$$ +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result new file mode 100644 index 00000000..d769f1a1 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result @@ -0,0 +1,203 @@ +# +# Start of 10.7 tests +# +# +# MDEV-4958 Adding datatype UUID +# +SET default_storage_engine=InnoDB; +# +# Range optimizer +# +CREATE TABLE t1 (a UUID, INDEX(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY))); +END FOR +$$ +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +a +00000000-0000-0000-0000-0000000000ff +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +SELECT * FROM t1 WHERE a='garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +EXPLAIN SELECT * FROM t1 WHERE a='garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; +a +00000000-0000-0000-0000-0000000000fe +00000000-0000-0000-0000-0000000000ff +EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index +SELECT * FROM t1 WHERE a>='garbage'; +a +EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'00000000-0000-0000-0000-0000000000f0' +); +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-0000000000a0 +00000000-0000-0000-0000-0000000000f0 +EXPLAIN SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'00000000-0000-0000-0000-0000000000f0' +); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 3 Using where; Using index +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'garbage' +); +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-0000000000a0 +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +EXPLAIN SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'garbage' +); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'00000000-0000-0000-0000-000000000081'; +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-000000000081 +EXPLAIN SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'00000000-0000-0000-0000-000000000081'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index +SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'garbage'; +a +EXPLAIN SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); +a +00000000-0000-0000-0000-0000000000ff +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref a a 17 const 1 100.00 Using where; Using index +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID,KEY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +BEGIN; +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +DROP TABLE t1; +# +# MDEV-26742 Assertion `field->type_handler() == this' failed in FixedBinTypeBundle<NATIVE_LEN, MAX_CHAR_LEN>::Type_handler_fbt::stored_field_cmp_to_item +# +CREATE TABLE t1 ( pk uuid, c text) engine=myisam; +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000',1); +CREATE TABLE t2 ( d text, KEY (d)) engine=innodb ; +Warnings: +Note 1071 Specified key was too long; max key length is 3072 bytes +INSERT INTO t2 VALUES (2); +SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d); +d pk c +Warnings: +Warning 1292 Incorrect uuid value: '2' +EXPLAIN SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 ALL d NULL NULL NULL 1 Using where +UPDATE t2 JOIN t1 ON ( t1.pk > t2.d) SET t1.c = 1; +ERROR 22007: Incorrect uuid value: '2' +DROP TABLE t1, t2; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.test new file mode 100644 index 00000000..941a7a73 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.test @@ -0,0 +1,31 @@ +--source include/have_innodb.inc + +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +SET default_storage_engine=InnoDB; +--source type_uuid_engines.inc + +--echo # +--echo # MDEV-26742 Assertion `field->type_handler() == this' failed in FixedBinTypeBundle<NATIVE_LEN, MAX_CHAR_LEN>::Type_handler_fbt::stored_field_cmp_to_item +--echo # + +CREATE TABLE t1 ( pk uuid, c text) engine=myisam; +INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000',1); +CREATE TABLE t2 ( d text, KEY (d)) engine=innodb ; +INSERT INTO t2 VALUES (2); +SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d); +EXPLAIN SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d); +--error ER_TRUNCATED_WRONG_VALUE +UPDATE t2 JOIN t1 ON ( t1.pk > t2.d) SET t1.c = 1; +DROP TABLE t1, t2; + + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result new file mode 100644 index 00000000..21086fef --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result @@ -0,0 +1,250 @@ +# +# Start of 10.5 tests +# +# +# MDEV-4958 Adding datatype UUID +# +SET default_storage_engine=MEMORY; +# +# Range optimizer +# +CREATE TABLE t1 (a UUID, INDEX(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY))); +END FOR +$$ +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +a +00000000-0000-0000-0000-0000000000ff +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +SELECT * FROM t1 WHERE a='garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +EXPLAIN SELECT * FROM t1 WHERE a='garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; +a +00000000-0000-0000-0000-0000000000fe +00000000-0000-0000-0000-0000000000ff +EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 256 Using where +SELECT * FROM t1 WHERE a>='garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 256 Using where +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'00000000-0000-0000-0000-0000000000f0' +); +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-0000000000a0 +00000000-0000-0000-0000-0000000000f0 +EXPLAIN SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'00000000-0000-0000-0000-0000000000f0' +); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 6 Using where +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'garbage' +); +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-0000000000a0 +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +EXPLAIN SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'garbage' +); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 4 Using where +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'00000000-0000-0000-0000-000000000081'; +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-000000000081 +EXPLAIN SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'00000000-0000-0000-0000-000000000081'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 256 Using where +SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +Warning 1292 Incorrect uuid value: 'garbage' +EXPLAIN SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 256 Using where +SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); +a +00000000-0000-0000-0000-0000000000ff +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref a a 17 const 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID,KEY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +BEGIN; +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 2 Using where +DROP TABLE t1; +# +# End of 10.5 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.test new file mode 100644 index 00000000..cdae2bc3 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.test @@ -0,0 +1,15 @@ +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +SET default_storage_engine=MEMORY; +--source type_uuid_engines.inc + + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result new file mode 100644 index 00000000..65dcabda --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from UUID UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DECIMAL(38,0) DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` decimal(38,0) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +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 uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 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)); +ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +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: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target decimal(38,0) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'decimal' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc decimal(38,0) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src decimal(38,0) DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +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 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +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)); +ERROR 01000: Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +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: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'decimal' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst decimal(38,0) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a decimal(38,0)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a decimal(38,0)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst decimal(38,0)) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'decimal' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS decimal(38,0) +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t decimal(38,0)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst decimal(38,0) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'decimal' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test new file mode 100644 index 00000000..234e31b6 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_decimal.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from UUID UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DECIMAL(38,0) DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DECIMAL(38,0) DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result new file mode 100644 index 00000000..ae19f916 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DOUBLE DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` double DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +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 uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 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)); +ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +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: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target double +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src double DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'double' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc double DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src double DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` double DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +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 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +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)); +ERROR 01000: Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +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: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'double' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst double DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a double) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a double) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst double) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst double DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'double' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS double +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t double) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst double DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'double' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test new file mode 100644 index 00000000..8e8529ae --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_double.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source DOUBLE DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target DOUBLE DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result new file mode 100644 index 00000000..c92584a8 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` int(11) DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +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 uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 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)); +ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +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: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(11) +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'int' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc int(11) DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(11) DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` int(11) DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +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 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +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)); +ERROR 01000: Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +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: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'int' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst int(11) DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(11)) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(11)) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(11)) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'int' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(11) +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t int(11)) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(11) DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'int' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test new file mode 100644 index 00000000..79a55566 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_int.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result new file mode 100644 index 00000000..a4feb55b --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source TIME DEFAULT '00:00:00'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` time DEFAULT '00:00:00', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +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 uuid value: '00:00:00' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 00:00:00 +2 00000000-0000-0000-0000-000000000000 00:00:00 +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)); +ERROR 22007: Incorrect uuid value: '00:00:00' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 00:00:00 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +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: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target time +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src time DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src time DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'time' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc time DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src time DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` time DEFAULT '00:00:00', + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +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 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 00:00:00 00000000-0000-0000-0000-000000000000 +2 00:00:00 00000000-0000-0000-0000-000000000000 +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)); +ERROR 22007: Incorrect time value: '00000000-0000-0000-0000-000000000000' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00:00:00 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +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: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'time' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst time DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a time) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a time) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst time) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst time DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'time' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS time +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t time) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst time DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'time' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test new file mode 100644 index 00000000..5182d0ce --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_time.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source TIME DEFAULT '00:00:00'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target TIME DEFAULT '00:00:00', source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result new file mode 100644 index 00000000..252704d5 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.result @@ -0,0 +1,353 @@ +# +# Start of 10.7 tests +# +# +# MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +# +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + `source` int(10) unsigned DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +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 uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +2 00000000-0000-0000-0000-000000000000 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)); +ERROR 22007: Incorrect uuid value: '0' for column `test`.`t3`.`target` at row 2 +SELECT * FROM v3; +id target source +1 00000000-0000-0000-0000-000000000000 0 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +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: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target int(10) unsigned +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +DECLARE dst uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a uuid) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a uuid) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst uuid) +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst uuid DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'int unsigned' as 'uuid' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS uuid +BEGIN +DECLARE rc int(10) unsigned DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src int(10) unsigned DEFAULT NULL; +DECLARE cur1 CURSOR(t uuid) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst uuid DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +# Start of type_store_assignment_incompatible.inc +SET @sql_mode_save= @@sql_mode; +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'); +SET @ignore= CASE WHEN @ignore IS NULL OR @ignore = '' THEN '' + WHEN @ignore NOT LIKE ' %' THEN CONCAT(' ',@ignore) +ELSE @ignore +END; +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` int(10) unsigned DEFAULT 0, + `source` uuid DEFAULT '00000000-0000-0000-0000-000000000000', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +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: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +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 1265 Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +2 0 00000000-0000-0000-0000-000000000000 +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)); +ERROR 01000: Data truncated for column 'target' at row 2 +SELECT * FROM v3; +id target source +1 0 00000000-0000-0000-0000-000000000000 +TRUNCATE TABLE t3; +SET sql_mode=@sql_mode_save; +DROP TABLE t3; +DROP VIEW v3; +CREATE TABLE t3 LIKE t2; +INSERT INTO t3 SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) SELECT id,source,source FROM t2; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 (id,target,source) VALUES (1,DEFAULT,DEFAULT) ON DUPLICATE KEY UPDATE target=source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +INSERT INTO t3 SELECT 1,DEFAULT(t2.target),DEFAULT(t2.source) FROM t2 ON DUPLICATE KEY UPDATE t3.target=t2.source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +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: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +UPDATE t3 SET target=source; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +UPDATE t2, t3 SET t3.target=t2.source WHERE t2.id=t3.id; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `test`.`t3`.`target` +SET @alter=CONCAT('ALTER', @ignore, ' TABLE t3 MODIFY target ', @source_type); +SELECT @alter; +@alter +ALTER TABLE t3 MODIFY target uuid +EXECUTE IMMEDIATE @alter; +ERROR HY000: Cannot cast 'int unsigned' as 'uuid' in assignment of `test`.`t3`.`target` +DROP TABLE t3; +DROP TABLE t2; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE dst int(10) unsigned DEFAULT NULL; +SET dst=src; +END; +$$ +CALL p1; +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst` +DROP PROCEDURE p1; +CREATE FUNCTION f1(a int(10) unsigned) RETURNS INT RETURN NULL;; +SELECT f1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `a` +DROP FUNCTION f1; +CREATE PROCEDURE p1(a int(10) unsigned) BEGIN END;; +CALL p1((SELECT source FROM t1 ORDER BY source LIMIT 1)); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `a` +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT dst int(10) unsigned) +BEGIN +DECLARE src uuid DEFAULT NULL; +SET dst=src; +END; +$$ +CREATE PROCEDURE p2() +BEGIN +DECLARE dst int(10) unsigned DEFAULT NULL; +CALL p1(dst); +END; +$$ +CALL p2(); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst` +SHOW WARNINGS; +Level Code Message +Error 4078 Cannot cast 'uuid' as 'int unsigned' in assignment of `dst` +Note 4094 At line 4 in test.p1 +Note 4094 At line 4 in test.p2 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +CREATE FUNCTION f1() RETURNS int(10) unsigned +BEGIN +DECLARE rc uuid DEFAULT NULL; +RETURN rc; +END; +$$ +SELECT f1(); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `f1()` +DROP FUNCTION f1; +CREATE PROCEDURE p1() +BEGIN +DECLARE src uuid DEFAULT NULL; +DECLARE cur1 CURSOR(t int(10) unsigned) FOR SELECT * FROM t1 WHERE target=t; +OPEN cur1(src); +CLOSE cur1; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `t` +DROP PROCEDURE p1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (); +CREATE PROCEDURE p1() +BEGIN +DECLARE dst int(10) unsigned DEFAULT NULL; +DECLARE cur2 CURSOR FOR SELECT source FROM t2 ORDER BY source LIMIT 1; +OPEN cur2; +FETCH cur2 INTO dst; +CLOSE cur2; +END; +$$ +CALL p1(); +ERROR HY000: Cannot cast 'uuid' as 'int unsigned' in assignment of `dst` +DROP PROCEDURE p1; +DROP TABLE t2; +# End of type_store_assignment_incompatible.inc +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test new file mode 100644 index 00000000..94de2dce --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mix_uint.test @@ -0,0 +1,19 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-28918 Implicit cast from INET6 UNSIGNED works differently on UPDATE vs ALTER +--echo # + +CREATE TABLE t1 (target UUID DEFAULT '00000000-0000-0000-0000-000000000000', source INT UNSIGNED DEFAULT 0); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +CREATE TABLE t1 (target INT UNSIGNED DEFAULT 0, source UUID DEFAULT '00000000-0000-0000-0000-000000000000'); +--source include/type_mix_incompatible.inc +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result new file mode 100644 index 00000000..736aea45 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result @@ -0,0 +1,237 @@ +# +# Start of 10.7 tests +# +# +# MDEV-4958 Adding datatype UUID +# +SET default_storage_engine=MyISAM; +# +# Range optimizer +# +CREATE TABLE t1 (a UUID, INDEX(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (CONCAT(REPEAT(0x00, 15),CHAR(i USING BINARY))); +END FOR +$$ +SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +a +00000000-0000-0000-0000-0000000000ff +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 7 Using where; Using index +SELECT * FROM t1 WHERE a='garbage'; +a +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +EXPLAIN SELECT * FROM t1 WHERE a='garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; +a +00000000-0000-0000-0000-0000000000fe +00000000-0000-0000-0000-0000000000ff +EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 28 Using where; Using index +SELECT * FROM t1 WHERE a>='garbage'; +a +EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'00000000-0000-0000-0000-0000000000f0' +); +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-0000000000a0 +00000000-0000-0000-0000-0000000000f0 +EXPLAIN SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'00000000-0000-0000-0000-0000000000f0' +); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 3 Using where; Using index +SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'garbage' +); +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-0000000000a0 +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +EXPLAIN SELECT * FROM t1 WHERE a IN +( +'00000000-0000-0000-0000-000000000080', +'00000000-0000-0000-0000-0000000000a0', +'garbage' +); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index +Warnings: +Warning 1292 Incorrect uuid value: 'garbage' +SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'00000000-0000-0000-0000-000000000081'; +a +00000000-0000-0000-0000-000000000080 +00000000-0000-0000-0000-000000000081 +EXPLAIN SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'00000000-0000-0000-0000-000000000081'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 17 NULL 1 Using where; Using index +SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'garbage'; +a +EXPLAIN SELECT * FROM t1 WHERE a BETWEEN +'00000000-0000-0000-0000-000000000080' AND +'garbage'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); +a +00000000-0000-0000-0000-0000000000ff +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ref a a 17 const 7 100.00 Using where; Using index +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff' +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (a UUID,KEY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +BEGIN; +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (REPLACE('XX000000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00XX0000-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('0000XX00-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('000000XX-0000-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-XX00-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-00XX-0000-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-XX00-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-00XX-0000-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-XX00-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-00XX-000000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-XX0000000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00XX00000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000XX000000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-000000XX0000','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-00000000XX00','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t1 VALUES (REPLACE('00000000-0000-0000-0000-0000000000XX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +COMMIT; +EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +DROP TABLE t1; +# +# Testing index prefix compression +# +CREATE PROCEDURE test_pack_key() +BEGIN +SHOW CREATE TABLE t1; +FOR i IN 0..0x1FFF +DO +INSERT INTO t1 VALUES (UUID()); +END FOR; +SELECT +CASE +WHEN INDEX_LENGTH/DATA_LENGTH < 0.7 THEN 'PACKED' + WHEN INDEX_LENGTH/DATA_LENGTH > 1.2 THEN 'NOT PACKED' + ELSE CONCAT('UNKNOWN ', INDEX_LENGTH/DATA_LENGTH) +END AS PackKey +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; +END; +$$ +"------------------ CREATE TABLE" +CREATE TABLE t1 (a UUID, KEY(a)); +CALL test_pack_key(); +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +PackKey +PACKED +DROP TABLE t1; +"------------------ t1packkey.frm" +TRUNCATE TABLE t1; +CALL test_pack_key(); +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +PackKey +PACKED +DROP TABLE t1; +"------------------ t1nopackkey.frm" +TRUNCATE TABLE t1; +CALL test_pack_key(); +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +PackKey +NOT PACKED +DROP TABLE t1; +DROP PROCEDURE test_pack_key; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test new file mode 100644 index 00000000..7526d344 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.test @@ -0,0 +1,61 @@ +let $MYSQLD_DATADIR= `select @@datadir`; + +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + + +SET default_storage_engine=MyISAM; +--source type_uuid_engines.inc + +--echo # +--echo # Testing index prefix compression +--echo # + +DELIMITER $$; +CREATE PROCEDURE test_pack_key() +BEGIN + SHOW CREATE TABLE t1; + FOR i IN 0..0x1FFF + DO + INSERT INTO t1 VALUES (UUID()); + END FOR; + SELECT + CASE + WHEN INDEX_LENGTH/DATA_LENGTH < 0.7 THEN 'PACKED' + WHEN INDEX_LENGTH/DATA_LENGTH > 1.2 THEN 'NOT PACKED' + ELSE CONCAT('UNKNOWN ', INDEX_LENGTH/DATA_LENGTH) + END AS PackKey + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'; +END; +$$ +DELIMITER ;$$ + +--echo "------------------ CREATE TABLE" +CREATE TABLE t1 (a UUID, KEY(a)); +CALL test_pack_key(); +DROP TABLE t1; + +--echo "------------------ t1packkey.frm" +--copy_file $MTR_SUITE_DIR/std_data/t1packkey.frm $MYSQLD_DATADIR/test/t1.frm +TRUNCATE TABLE t1; +CALL test_pack_key(); +DROP TABLE t1; + +--echo "------------------ t1nopackkey.frm" +--copy_file $MTR_SUITE_DIR/std_data/t1nopackkey.frm $MYSQLD_DATADIR/test/t1.frm +TRUNCATE TABLE t1; +CALL test_pack_key(); +DROP TABLE t1; + + +DROP PROCEDURE test_pack_key; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.result new file mode 100644 index 00000000..51531e5c --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.result @@ -0,0 +1,16 @@ +CREATE TABLE t1 (a UUID); +Field 1: `a` +Org_field: `a` +Catalog: `def` +Database: `test` +Table: `t1` +Org_table: `t1` +Type: STRING (type=uuid) +Collation: latin1_swedish_ci (8) +Length: 36 +Max_length: 0 +Decimals: 0 +Flags: UNSIGNED BINARY + + +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.test new file mode 100644 index 00000000..c9bfadca --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_mysql.test @@ -0,0 +1,6 @@ +-- source include/have_working_dns.inc +-- source include/not_embedded.inc + +CREATE TABLE t1 (a UUID); +--exec $MYSQL -t test --column-type-info -e "SELECT * FROM t1" 2>&1 +DROP TABLE t1; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result new file mode 100644 index 00000000..82b96002 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.result @@ -0,0 +1,1797 @@ +# +# MDEV-4958 Adding datatype UUID +# +SET NAMES utf8; +CREATE TABLE t1 (a UUID) +PARTITION BY LIST COLUMNS(a) +(PARTITION p00 VALUES IN (10)); +ERROR HY000: Partition column values of incorrect type +CREATE TABLE t1 (a UUID) +PARTITION BY LIST COLUMNS(a) +(PARTITION p00 VALUES IN (TIME'10:20:30')); +ERROR HY000: Partition column values of incorrect type +CREATE TABLE t1 (a UUID) +PARTITION BY LIST COLUMNS(a) +(PARTITION p00 VALUES IN ('€')); +ERROR 22007: Incorrect uuid value: '€' +CREATE TABLE t1 (a UUID) +PARTITION BY LIST COLUMNS(a) +(PARTITION p00 VALUES IN ('123e4567-e89b-12d3-a456-426655440000'), +PARTITION pFF VALUES IN (0xffff000000000000000000000000ffff)); +INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440000'); +INSERT INTO t1 VALUES ('ffff0000-0000-0000-0000-00000000ffff'); +SELECT * FROM t1 PARTITION (p00); +a +123e4567-e89b-12d3-a456-426655440000 +SELECT * FROM t1 PARTITION (pFF); +a +ffff0000-0000-0000-0000-00000000ffff +DROP TABLE t1; +CREATE TABLE t0 (a UUID); +FOR i IN 0..255 +DO +INSERT INTO t0 VALUES (REPLACE('XXfd306d-307f-11ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-XX7f-12ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-13XX-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-14ec-8dXX-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-15ec-8d10-XX0bbc909b57','XX',LPAD(HEX(i),2,'0'))); +INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-16ec-8d10-d20bbc909bXX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +# Test that UUID and BINARY(16) implement the same distribution by key +CREATE PROCEDURE test_partition_by_key_uuid_vs_binary(parts INT) +BEGIN +EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts); +EXECUTE IMMEDIATE REPLACE('CREATE TABLE t2 (a BINARY(16)) PARTITION BY KEY (a) PARTITIONS 7','7',parts); +INSERT INTO t1 SELECT * FROM t0; +INSERT INTO t2 SELECT * FROM t0; +FOR i IN 0..(parts-1) +DO +BEGIN +DECLARE query_template TEXT DEFAULT 'SELECT a_p0, COUNT(*) FROM (' + 'SELECT a AS a_p0 FROM t1 PARTITION(p0) ' + 'UNION ALL ' + 'SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td ' + 'GROUP BY a_p0'; +DECLARE query TEXT DEFAULT REPLACE(query_template,'p0',CONCAT('p',i)); +SELECT query; +EXECUTE IMMEDIATE query; +END; +END FOR; +DROP TABLE t1,t2; +END; +$$ +# Display statistics how records are distributed between partitions +CREATE PROCEDURE test_partition_by_key_pstat(parts INT) +BEGIN +EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts); +CREATE TABLE t1_pstat (pname VARCHAR(32), pcount int); +INSERT INTO t1 SELECT * FROM t0; +FOR i IN 0..(parts-1) +DO +BEGIN +DECLARE query_template TEXT DEFAULT 'INSERT INTO t1_pstat VALUES (''p0'',(SELECT COUNT(*) FROM t1 PARTITION (p0)))'; +EXECUTE IMMEDIATE REPLACE(query_template,'p0',CONCAT('p',i)); +END; +END FOR; +SELECT * FROM t1_pstat ORDER BY CAST(SUBSTR(pname,2,100) AS UNSIGNED); +DROP TABLE t1,t1_pstat; +END; +$$ +CALL test_partition_by_key_uuid_vs_binary(7); +query +SELECT a_p0, COUNT(*) FROM (SELECT a AS a_p0 FROM t1 PARTITION(p0) UNION ALL SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td GROUP BY a_p0 +a_p0 COUNT(*) +9cfd306d-307f-15ec-8d10-010bbc909b57 2 +9cfd306d-307f-15ec-8d10-080bbc909b57 2 +9cfd306d-307f-15ec-8d10-0d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-250bbc909b57 2 +9cfd306d-307f-15ec-8d10-2b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-300bbc909b57 2 +9cfd306d-307f-15ec-8d10-3c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-480bbc909b57 2 +9cfd306d-307f-15ec-8d10-500bbc909b57 2 +9cfd306d-307f-15ec-8d10-530bbc909b57 2 +9cfd306d-307f-15ec-8d10-560bbc909b57 2 +9cfd306d-307f-15ec-8d10-570bbc909b57 2 +9cfd306d-307f-15ec-8d10-580bbc909b57 2 +9cfd306d-307f-15ec-8d10-630bbc909b57 2 +9cfd306d-307f-15ec-8d10-680bbc909b57 2 +9cfd306d-307f-15ec-8d10-6a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-700bbc909b57 2 +9cfd306d-307f-15ec-8d10-7e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-820bbc909b57 2 +9cfd306d-307f-15ec-8d10-8e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-930bbc909b57 2 +9cfd306d-307f-15ec-8d10-970bbc909b57 2 +9cfd306d-307f-15ec-8d10-980bbc909b57 2 +9cfd306d-307f-15ec-8d10-9b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-9f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-a00bbc909b57 2 +9cfd306d-307f-15ec-8d10-a70bbc909b57 2 +9cfd306d-307f-15ec-8d10-a80bbc909b57 2 +9cfd306d-307f-15ec-8d10-b80bbc909b57 2 +9cfd306d-307f-15ec-8d10-c10bbc909b57 2 +9cfd306d-307f-15ec-8d10-c30bbc909b57 2 +9cfd306d-307f-15ec-8d10-c60bbc909b57 2 +9cfd306d-307f-15ec-8d10-cb0bbc909b57 2 +9cfd306d-307f-15ec-8d10-cf0bbc909b57 2 +9cfd306d-307f-15ec-8d10-d00bbc909b57 2 +9cfd306d-307f-15ec-8d10-d10bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b04 2 +9cfd306d-307f-16ec-8d10-d20bbc909b13 2 +9cfd306d-307f-16ec-8d10-d20bbc909b29 2 +9cfd306d-307f-16ec-8d10-d20bbc909b31 2 +9cfd306d-307f-16ec-8d10-d20bbc909b37 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b45 2 +9cfd306d-307f-16ec-8d10-d20bbc909b51 2 +9cfd306d-307f-16ec-8d10-d20bbc909b56 2 +9cfd306d-307f-14ec-8d05-d20bbc909b57 2 +9cfd306d-307f-14ec-8d07-d20bbc909b57 2 +0bfd306d-307f-11ec-8d10-d20bbc909b57 2 +0dfd306d-307f-11ec-8d10-d20bbc909b57 2 +16fd306d-307f-11ec-8d10-d20bbc909b57 2 +17fd306d-307f-11ec-8d10-d20bbc909b57 2 +19fd306d-307f-11ec-8d10-d20bbc909b57 2 +34fd306d-307f-11ec-8d10-d20bbc909b57 2 +36fd306d-307f-11ec-8d10-d20bbc909b57 2 +48fd306d-307f-11ec-8d10-d20bbc909b57 2 +58fd306d-307f-11ec-8d10-d20bbc909b57 2 +61fd306d-307f-11ec-8d10-d20bbc909b57 2 +76fd306d-307f-11ec-8d10-d20bbc909b57 2 +78fd306d-307f-11ec-8d10-d20bbc909b57 2 +7efd306d-307f-11ec-8d10-d20bbc909b57 2 +7ffd306d-307f-11ec-8d10-d20bbc909b57 2 +85fd306d-307f-11ec-8d10-d20bbc909b57 2 +8ffd306d-307f-11ec-8d10-d20bbc909b57 2 +91fd306d-307f-11ec-8d10-d20bbc909b57 2 +9bfd306d-307f-11ec-8d10-d20bbc909b57 2 +affd306d-307f-11ec-8d10-d20bbc909b57 2 +b2fd306d-307f-11ec-8d10-d20bbc909b57 2 +b3fd306d-307f-11ec-8d10-d20bbc909b57 2 +b4fd306d-307f-11ec-8d10-d20bbc909b57 2 +c3fd306d-307f-11ec-8d10-d20bbc909b57 2 +cdfd306d-307f-11ec-8d10-d20bbc909b57 2 +d0fd306d-307f-11ec-8d10-d20bbc909b57 2 +d3fd306d-307f-11ec-8d10-d20bbc909b57 2 +d4fd306d-307f-11ec-8d10-d20bbc909b57 2 +e4fd306d-307f-11ec-8d10-d20bbc909b57 2 +f3fd306d-307f-11ec-8d10-d20bbc909b57 2 +f6fd306d-307f-11ec-8d10-d20bbc909b57 2 +f7fd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-0e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-177f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-347f-12ec-8d10-d20bbc909b57 2 +9cfd306d-377f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-447f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-527f-12ec-8d10-d20bbc909b57 2 +9cfd306d-537f-12ec-8d10-d20bbc909b57 2 +9cfd306d-547f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-727f-12ec-8d10-d20bbc909b57 2 +9cfd306d-787f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-807f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-977f-12ec-8d10-d20bbc909b57 2 +9cfd306d-987f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ac7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-bb7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fd7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1300-8d10-d20bbc909b57 2 +9cfd306d-307f-1309-8d10-d20bbc909b57 2 +9cfd306d-307f-130b-8d10-d20bbc909b57 2 +9cfd306d-307f-130e-8d10-d20bbc909b57 2 +9cfd306d-307f-1313-8d10-d20bbc909b57 2 +9cfd306d-307f-1329-8d10-d20bbc909b57 2 +9cfd306d-307f-132a-8d10-d20bbc909b57 2 +9cfd306d-307f-1332-8d10-d20bbc909b57 2 +9cfd306d-307f-1336-8d10-d20bbc909b57 2 +9cfd306d-307f-1337-8d10-d20bbc909b57 2 +9cfd306d-307f-133d-8d10-d20bbc909b57 2 +9cfd306d-307f-1340-8d10-d20bbc909b57 2 +9cfd306d-307f-134d-8d10-d20bbc909b57 2 +9cfd306d-307f-1351-8d10-d20bbc909b57 2 +9cfd306d-307f-1363-8d10-d20bbc909b57 2 +9cfd306d-307f-1375-8d10-d20bbc909b57 2 +9cfd306d-307f-137d-8d10-d20bbc909b57 2 +9cfd306d-307f-137e-8d10-d20bbc909b57 2 +9cfd306d-307f-138e-8d10-d20bbc909b57 2 +9cfd306d-307f-139f-8d10-d20bbc909b57 2 +9cfd306d-307f-13a1-8d10-d20bbc909b57 2 +9cfd306d-307f-13a2-8d10-d20bbc909b57 2 +9cfd306d-307f-13b1-8d10-d20bbc909b57 2 +9cfd306d-307f-13b3-8d10-d20bbc909b57 2 +9cfd306d-307f-13b5-8d10-d20bbc909b57 2 +9cfd306d-307f-13bf-8d10-d20bbc909b57 2 +9cfd306d-307f-13d0-8d10-d20bbc909b57 2 +9cfd306d-307f-13db-8d10-d20bbc909b57 2 +9cfd306d-307f-13fe-8d10-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d27-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d30-d20bbc909b57 2 +9cfd306d-307f-14ec-8d33-d20bbc909b57 2 +9cfd306d-307f-14ec-8d36-d20bbc909b57 2 +9cfd306d-307f-14ec-8d38-d20bbc909b57 2 +9cfd306d-307f-14ec-8d40-d20bbc909b57 2 +9cfd306d-307f-14ec-8d42-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d50-d20bbc909b57 2 +9cfd306d-307f-14ec-8d51-d20bbc909b57 2 +9cfd306d-307f-14ec-8d59-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d63-d20bbc909b57 2 +9cfd306d-307f-14ec-8d67-d20bbc909b57 2 +9cfd306d-307f-14ec-8d68-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d75-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d81-d20bbc909b57 2 +9cfd306d-307f-14ec-8d82-d20bbc909b57 2 +9cfd306d-307f-14ec-8d86-d20bbc909b57 2 +9cfd306d-307f-14ec-8d87-d20bbc909b57 2 +9cfd306d-307f-14ec-8d94-d20bbc909b57 2 +9cfd306d-307f-14ec-8d95-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9f-d20bbc909b57 2 +9cfd306d-307f-14ec-8db4-d20bbc909b57 2 +9cfd306d-307f-14ec-8db9-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd3-d20bbc909b57 2 +9cfd306d-307f-14ec-8de1-d20bbc909b57 2 +9cfd306d-307f-14ec-8de6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dee-d20bbc909b57 2 +9cfd306d-307f-14ec-8df1-d20bbc909b57 2 +9cfd306d-307f-14ec-8df6-d20bbc909b57 2 +9cfd306d-307f-14ec-8df7-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b69 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b72 2 +9cfd306d-307f-16ec-8d10-d20bbc909b78 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b82 2 +9cfd306d-307f-16ec-8d10-d20bbc909b83 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9c 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba2 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bab 2 +9cfd306d-307f-16ec-8d10-d20bbc909bac 2 +9cfd306d-307f-16ec-8d10-d20bbc909bad 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bdf 2 +9cfd306d-307f-16ec-8d10-d20bbc909be8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bee 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf0 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf1 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf2 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfb 2 +9cfd306d-307f-16ec-8d10-d20bbc909bff 2 +9cfd306d-307f-15ec-8d10-d40bbc909b57 2 +9cfd306d-307f-15ec-8d10-df0bbc909b57 2 +9cfd306d-307f-15ec-8d10-e40bbc909b57 2 +9cfd306d-307f-15ec-8d10-eb0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ef0bbc909b57 2 +9cfd306d-307f-15ec-8d10-f10bbc909b57 2 +9cfd306d-307f-15ec-8d10-f90bbc909b57 2 +query +SELECT a_p1, COUNT(*) FROM (SELECT a AS a_p1 FROM t1 PARTITION(p1) UNION ALL SELECT CAST(a AS UUID) AS a_p1 FROM t2 PARTITION(p1)) td GROUP BY a_p1 +a_p1 COUNT(*) +9cfd306d-307f-15ec-8d10-060bbc909b57 2 +9cfd306d-307f-15ec-8d10-0c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-120bbc909b57 2 +9cfd306d-307f-15ec-8d10-150bbc909b57 2 +9cfd306d-307f-15ec-8d10-1a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-1c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-1d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-1f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-230bbc909b57 2 +9cfd306d-307f-15ec-8d10-2d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-310bbc909b57 2 +9cfd306d-307f-15ec-8d10-3a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-3e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-400bbc909b57 2 +9cfd306d-307f-15ec-8d10-4c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-5e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-5f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-7b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-7d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-8c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-910bbc909b57 2 +9cfd306d-307f-15ec-8d10-920bbc909b57 2 +9cfd306d-307f-15ec-8d10-940bbc909b57 2 +9cfd306d-307f-15ec-8d10-950bbc909b57 2 +9cfd306d-307f-15ec-8d10-9d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-a20bbc909b57 2 +9cfd306d-307f-15ec-8d10-aa0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ac0bbc909b57 2 +9cfd306d-307f-15ec-8d10-af0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ba0bbc909b57 2 +9cfd306d-307f-15ec-8d10-bc0bbc909b57 2 +9cfd306d-307f-15ec-8d10-c50bbc909b57 2 +9cfd306d-307f-15ec-8d10-cc0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b05 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b34 2 +9cfd306d-307f-16ec-8d10-d20bbc909b35 2 +9cfd306d-307f-16ec-8d10-d20bbc909b42 2 +00fd306d-307f-11ec-8d10-d20bbc909b57 2 +09fd306d-307f-11ec-8d10-d20bbc909b57 2 +10fd306d-307f-11ec-8d10-d20bbc909b57 2 +13fd306d-307f-11ec-8d10-d20bbc909b57 2 +1cfd306d-307f-11ec-8d10-d20bbc909b57 2 +3ffd306d-307f-11ec-8d10-d20bbc909b57 2 +45fd306d-307f-11ec-8d10-d20bbc909b57 2 +4efd306d-307f-11ec-8d10-d20bbc909b57 2 +4ffd306d-307f-11ec-8d10-d20bbc909b57 2 +50fd306d-307f-11ec-8d10-d20bbc909b57 2 +54fd306d-307f-11ec-8d10-d20bbc909b57 2 +55fd306d-307f-11ec-8d10-d20bbc909b57 2 +5bfd306d-307f-11ec-8d10-d20bbc909b57 2 +5ffd306d-307f-11ec-8d10-d20bbc909b57 2 +6ffd306d-307f-11ec-8d10-d20bbc909b57 2 +73fd306d-307f-11ec-8d10-d20bbc909b57 2 +89fd306d-307f-11ec-8d10-d20bbc909b57 2 +8cfd306d-307f-11ec-8d10-d20bbc909b57 2 +8dfd306d-307f-11ec-8d10-d20bbc909b57 2 +93fd306d-307f-11ec-8d10-d20bbc909b57 2 +94fd306d-307f-11ec-8d10-d20bbc909b57 2 +9efd306d-307f-11ec-8d10-d20bbc909b57 2 +aefd306d-307f-11ec-8d10-d20bbc909b57 2 +b0fd306d-307f-11ec-8d10-d20bbc909b57 2 +c2fd306d-307f-11ec-8d10-d20bbc909b57 2 +cbfd306d-307f-11ec-8d10-d20bbc909b57 2 +ddfd306d-307f-11ec-8d10-d20bbc909b57 2 +defd306d-307f-11ec-8d10-d20bbc909b57 2 +e5fd306d-307f-11ec-8d10-d20bbc909b57 2 +e6fd306d-307f-11ec-8d10-d20bbc909b57 2 +edfd306d-307f-11ec-8d10-d20bbc909b57 2 +f9fd306d-307f-11ec-8d10-d20bbc909b57 2 +fafd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-007f-12ec-8d10-d20bbc909b57 2 +9cfd306d-037f-12ec-8d10-d20bbc909b57 2 +9cfd306d-047f-12ec-8d10-d20bbc909b57 2 +9cfd306d-057f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-117f-12ec-8d10-d20bbc909b57 2 +9cfd306d-127f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-207f-12ec-8d10-d20bbc909b57 2 +9cfd306d-227f-12ec-8d10-d20bbc909b57 2 +9cfd306d-247f-12ec-8d10-d20bbc909b57 2 +9cfd306d-277f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-12ec-8d10-d20bbc909b57 2 +9cfd306d-317f-12ec-8d10-d20bbc909b57 2 +9cfd306d-357f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-407f-12ec-8d10-d20bbc909b57 2 +9cfd306d-437f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-657f-12ec-8d10-d20bbc909b57 2 +9cfd306d-747f-12ec-8d10-d20bbc909b57 2 +9cfd306d-817f-12ec-8d10-d20bbc909b57 2 +9cfd306d-927f-12ec-8d10-d20bbc909b57 2 +9cfd306d-967f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-bd7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-dd7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ea7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1314-8d10-d20bbc909b57 2 +9cfd306d-307f-1319-8d10-d20bbc909b57 2 +9cfd306d-307f-131e-8d10-d20bbc909b57 2 +9cfd306d-307f-1325-8d10-d20bbc909b57 2 +9cfd306d-307f-132d-8d10-d20bbc909b57 2 +9cfd306d-307f-132e-8d10-d20bbc909b57 2 +9cfd306d-307f-1330-8d10-d20bbc909b57 2 +9cfd306d-307f-1335-8d10-d20bbc909b57 2 +9cfd306d-307f-1339-8d10-d20bbc909b57 2 +9cfd306d-307f-1341-8d10-d20bbc909b57 2 +9cfd306d-307f-1345-8d10-d20bbc909b57 2 +9cfd306d-307f-1355-8d10-d20bbc909b57 2 +9cfd306d-307f-135a-8d10-d20bbc909b57 2 +9cfd306d-307f-135b-8d10-d20bbc909b57 2 +9cfd306d-307f-135c-8d10-d20bbc909b57 2 +9cfd306d-307f-1379-8d10-d20bbc909b57 2 +9cfd306d-307f-137f-8d10-d20bbc909b57 2 +9cfd306d-307f-1383-8d10-d20bbc909b57 2 +9cfd306d-307f-1388-8d10-d20bbc909b57 2 +9cfd306d-307f-1389-8d10-d20bbc909b57 2 +9cfd306d-307f-138c-8d10-d20bbc909b57 2 +9cfd306d-307f-138d-8d10-d20bbc909b57 2 +9cfd306d-307f-138f-8d10-d20bbc909b57 2 +9cfd306d-307f-1390-8d10-d20bbc909b57 2 +9cfd306d-307f-1391-8d10-d20bbc909b57 2 +9cfd306d-307f-139c-8d10-d20bbc909b57 2 +9cfd306d-307f-13a3-8d10-d20bbc909b57 2 +9cfd306d-307f-13aa-8d10-d20bbc909b57 2 +9cfd306d-307f-13ab-8d10-d20bbc909b57 2 +9cfd306d-307f-13af-8d10-d20bbc909b57 2 +9cfd306d-307f-13b4-8d10-d20bbc909b57 2 +9cfd306d-307f-13bc-8d10-d20bbc909b57 2 +9cfd306d-307f-13be-8d10-d20bbc909b57 2 +9cfd306d-307f-13c2-8d10-d20bbc909b57 2 +9cfd306d-307f-13c8-8d10-d20bbc909b57 2 +9cfd306d-307f-13cf-8d10-d20bbc909b57 2 +9cfd306d-307f-13e0-8d10-d20bbc909b57 2 +9cfd306d-307f-13e7-8d10-d20bbc909b57 2 +9cfd306d-307f-13fa-8d10-d20bbc909b57 2 +9cfd306d-307f-15ec-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d11-d20bbc909b57 2 +9cfd306d-307f-14ec-8d17-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d37-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d45-d20bbc909b57 2 +9cfd306d-307f-14ec-8d47-d20bbc909b57 2 +9cfd306d-307f-14ec-8d49-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d57-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d78-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d88-d20bbc909b57 2 +9cfd306d-307f-14ec-8d89-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d92-d20bbc909b57 2 +9cfd306d-307f-14ec-8d97-d20bbc909b57 2 +9cfd306d-307f-14ec-8da0-d20bbc909b57 2 +9cfd306d-307f-14ec-8da3-d20bbc909b57 2 +9cfd306d-307f-14ec-8da5-d20bbc909b57 2 +9cfd306d-307f-14ec-8daa-d20bbc909b57 2 +9cfd306d-307f-14ec-8db5-d20bbc909b57 2 +9cfd306d-307f-14ec-8dcc-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd1-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dda-d20bbc909b57 2 +9cfd306d-307f-14ec-8ddd-d20bbc909b57 2 +9cfd306d-307f-14ec-8df9-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b65 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b73 2 +9cfd306d-307f-16ec-8d10-d20bbc909b80 2 +9cfd306d-307f-16ec-8d10-d20bbc909b86 2 +9cfd306d-307f-16ec-8d10-d20bbc909b87 2 +9cfd306d-307f-16ec-8d10-d20bbc909b89 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8e 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bae 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb0 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb1 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb7 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbb 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bca 2 +9cfd306d-307f-16ec-8d10-d20bbc909bcf 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfc 2 +9cfd306d-307f-15ec-8d10-d30bbc909b57 2 +9cfd306d-307f-15ec-8d10-dc0bbc909b57 2 +9cfd306d-307f-15ec-8d10-e30bbc909b57 2 +9cfd306d-307f-15ec-8d10-e80bbc909b57 2 +9cfd306d-307f-15ec-8d10-ed0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ee0bbc909b57 2 +query +SELECT a_p2, COUNT(*) FROM (SELECT a AS a_p2 FROM t1 PARTITION(p2) UNION ALL SELECT CAST(a AS UUID) AS a_p2 FROM t2 PARTITION(p2)) td GROUP BY a_p2 +a_p2 COUNT(*) +9cfd306d-307f-15ec-8d10-040bbc909b57 2 +9cfd306d-307f-15ec-8d10-0f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-100bbc909b57 2 +9cfd306d-307f-15ec-8d10-110bbc909b57 2 +9cfd306d-307f-15ec-8d10-130bbc909b57 2 +9cfd306d-307f-15ec-8d10-180bbc909b57 2 +9cfd306d-307f-15ec-8d10-1e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-320bbc909b57 2 +9cfd306d-307f-15ec-8d10-330bbc909b57 2 +9cfd306d-307f-15ec-8d10-430bbc909b57 2 +9cfd306d-307f-15ec-8d10-460bbc909b57 2 +9cfd306d-307f-15ec-8d10-520bbc909b57 2 +9cfd306d-307f-15ec-8d10-650bbc909b57 2 +9cfd306d-307f-15ec-8d10-660bbc909b57 2 +9cfd306d-307f-15ec-8d10-6e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-750bbc909b57 2 +9cfd306d-307f-15ec-8d10-780bbc909b57 2 +9cfd306d-307f-15ec-8d10-790bbc909b57 2 +9cfd306d-307f-15ec-8d10-830bbc909b57 2 +9cfd306d-307f-15ec-8d10-8f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-900bbc909b57 2 +9cfd306d-307f-15ec-8d10-9a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-9c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-a40bbc909b57 2 +9cfd306d-307f-15ec-8d10-c00bbc909b57 2 +9cfd306d-307f-15ec-8d10-c20bbc909b57 2 +9cfd306d-307f-15ec-8d10-c40bbc909b57 2 +9cfd306d-307f-15ec-8d10-cd0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b02 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b16 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b26 2 +9cfd306d-307f-16ec-8d10-d20bbc909b27 2 +9cfd306d-307f-16ec-8d10-d20bbc909b38 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b43 2 +9cfd306d-307f-16ec-8d10-d20bbc909b46 2 +9cfd306d-307f-16ec-8d10-d20bbc909b47 2 +9cfd306d-307f-16ec-8d10-d20bbc909b49 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4f 2 +9cfd306d-307f-14ec-8d01-d20bbc909b57 2 +9cfd306d-307f-14ec-8d06-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0a-d20bbc909b57 2 +02fd306d-307f-11ec-8d10-d20bbc909b57 2 +07fd306d-307f-11ec-8d10-d20bbc909b57 2 +08fd306d-307f-11ec-8d10-d20bbc909b57 2 +0efd306d-307f-11ec-8d10-d20bbc909b57 2 +1afd306d-307f-11ec-8d10-d20bbc909b57 2 +20fd306d-307f-11ec-8d10-d20bbc909b57 2 +25fd306d-307f-11ec-8d10-d20bbc909b57 2 +26fd306d-307f-11ec-8d10-d20bbc909b57 2 +2afd306d-307f-11ec-8d10-d20bbc909b57 2 +2dfd306d-307f-11ec-8d10-d20bbc909b57 2 +32fd306d-307f-11ec-8d10-d20bbc909b57 2 +33fd306d-307f-11ec-8d10-d20bbc909b57 2 +3dfd306d-307f-11ec-8d10-d20bbc909b57 2 +42fd306d-307f-11ec-8d10-d20bbc909b57 2 +46fd306d-307f-11ec-8d10-d20bbc909b57 2 +4bfd306d-307f-11ec-8d10-d20bbc909b57 2 +53fd306d-307f-11ec-8d10-d20bbc909b57 2 +5afd306d-307f-11ec-8d10-d20bbc909b57 2 +65fd306d-307f-11ec-8d10-d20bbc909b57 2 +69fd306d-307f-11ec-8d10-d20bbc909b57 2 +6bfd306d-307f-11ec-8d10-d20bbc909b57 2 +7cfd306d-307f-11ec-8d10-d20bbc909b57 2 +82fd306d-307f-11ec-8d10-d20bbc909b57 2 +86fd306d-307f-11ec-8d10-d20bbc909b57 2 +99fd306d-307f-11ec-8d10-d20bbc909b57 2 +9afd306d-307f-11ec-8d10-d20bbc909b57 2 +a3fd306d-307f-11ec-8d10-d20bbc909b57 2 +aafd306d-307f-11ec-8d10-d20bbc909b57 2 +ccfd306d-307f-11ec-8d10-d20bbc909b57 2 +d5fd306d-307f-11ec-8d10-d20bbc909b57 2 +dcfd306d-307f-11ec-8d10-d20bbc909b57 2 +e0fd306d-307f-11ec-8d10-d20bbc909b57 2 +f0fd306d-307f-11ec-8d10-d20bbc909b57 2 +f1fd306d-307f-11ec-8d10-d20bbc909b57 2 +f4fd306d-307f-11ec-8d10-d20bbc909b57 2 +f8fd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-097f-12ec-8d10-d20bbc909b57 2 +9cfd306d-137f-12ec-8d10-d20bbc909b57 2 +9cfd306d-267f-12ec-8d10-d20bbc909b57 2 +9cfd306d-297f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-757f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-867f-12ec-8d10-d20bbc909b57 2 +9cfd306d-897f-12ec-8d10-d20bbc909b57 2 +9cfd306d-907f-12ec-8d10-d20bbc909b57 2 +9cfd306d-937f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ab7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-da7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-eb7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ec7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ff7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-131c-8d10-d20bbc909b57 2 +9cfd306d-307f-1320-8d10-d20bbc909b57 2 +9cfd306d-307f-1321-8d10-d20bbc909b57 2 +9cfd306d-307f-1327-8d10-d20bbc909b57 2 +9cfd306d-307f-1331-8d10-d20bbc909b57 2 +9cfd306d-307f-1338-8d10-d20bbc909b57 2 +9cfd306d-307f-133a-8d10-d20bbc909b57 2 +9cfd306d-307f-133b-8d10-d20bbc909b57 2 +9cfd306d-307f-133e-8d10-d20bbc909b57 2 +9cfd306d-307f-1356-8d10-d20bbc909b57 2 +9cfd306d-307f-135e-8d10-d20bbc909b57 2 +9cfd306d-307f-1361-8d10-d20bbc909b57 2 +9cfd306d-307f-1368-8d10-d20bbc909b57 2 +9cfd306d-307f-136a-8d10-d20bbc909b57 2 +9cfd306d-307f-136c-8d10-d20bbc909b57 2 +9cfd306d-307f-136e-8d10-d20bbc909b57 2 +9cfd306d-307f-136f-8d10-d20bbc909b57 2 +9cfd306d-307f-1372-8d10-d20bbc909b57 2 +9cfd306d-307f-1376-8d10-d20bbc909b57 2 +9cfd306d-307f-1381-8d10-d20bbc909b57 2 +9cfd306d-307f-1382-8d10-d20bbc909b57 2 +9cfd306d-307f-1385-8d10-d20bbc909b57 2 +9cfd306d-307f-1386-8d10-d20bbc909b57 2 +9cfd306d-307f-1387-8d10-d20bbc909b57 2 +9cfd306d-307f-138a-8d10-d20bbc909b57 2 +9cfd306d-307f-1394-8d10-d20bbc909b57 2 +9cfd306d-307f-1398-8d10-d20bbc909b57 2 +9cfd306d-307f-13a6-8d10-d20bbc909b57 2 +9cfd306d-307f-13a7-8d10-d20bbc909b57 2 +9cfd306d-307f-13b0-8d10-d20bbc909b57 2 +9cfd306d-307f-13b8-8d10-d20bbc909b57 2 +9cfd306d-307f-13ba-8d10-d20bbc909b57 2 +9cfd306d-307f-13bb-8d10-d20bbc909b57 2 +9cfd306d-307f-13c0-8d10-d20bbc909b57 2 +9cfd306d-307f-13ca-8d10-d20bbc909b57 2 +9cfd306d-307f-13ce-8d10-d20bbc909b57 2 +9cfd306d-307f-13d1-8d10-d20bbc909b57 2 +9cfd306d-307f-13d3-8d10-d20bbc909b57 2 +9cfd306d-307f-13d6-8d10-d20bbc909b57 2 +9cfd306d-307f-13d8-8d10-d20bbc909b57 2 +9cfd306d-307f-13df-8d10-d20bbc909b57 2 +9cfd306d-307f-13e9-8d10-d20bbc909b57 2 +9cfd306d-307f-13eb-8d10-d20bbc909b57 2 +9cfd306d-307f-13f5-8d10-d20bbc909b57 2 +9cfd306d-307f-13f7-8d10-d20bbc909b57 2 +9cfd306d-307f-13f9-8d10-d20bbc909b57 2 +9cfd306d-307f-13fb-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d31-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d44-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d61-d20bbc909b57 2 +9cfd306d-307f-14ec-8d76-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d96-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9b-d20bbc909b57 2 +9cfd306d-307f-14ec-8da6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dab-d20bbc909b57 2 +9cfd306d-307f-14ec-8dad-d20bbc909b57 2 +9cfd306d-307f-14ec-8dba-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbd-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc5-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd4-d20bbc909b57 2 +9cfd306d-307f-14ec-8de5-d20bbc909b57 2 +9cfd306d-307f-14ec-8de8-d20bbc909b57 2 +9cfd306d-307f-14ec-8de9-d20bbc909b57 2 +9cfd306d-307f-14ec-8def-d20bbc909b57 2 +9cfd306d-307f-14ec-8df8-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b58 2 +9cfd306d-307f-16ec-8d10-d20bbc909b62 2 +9cfd306d-307f-16ec-8d10-d20bbc909b63 2 +9cfd306d-307f-16ec-8d10-d20bbc909b70 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b81 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b94 2 +9cfd306d-307f-16ec-8d10-d20bbc909b95 2 +9cfd306d-307f-16ec-8d10-d20bbc909b96 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9f 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba7 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb5 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbc 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbf 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc7 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd2 2 +9cfd306d-307f-16ec-8d10-d20bbc909bdd 2 +9cfd306d-307f-16ec-8d10-d20bbc909be0 2 +9cfd306d-307f-16ec-8d10-d20bbc909be1 2 +9cfd306d-307f-16ec-8d10-d20bbc909be6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bec 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfa 2 +9cfd306d-307f-15ec-8d10-e20bbc909b57 2 +9cfd306d-307f-15ec-8d10-ec0bbc909b57 2 +9cfd306d-307f-15ec-8d10-f70bbc909b57 2 +9cfd306d-307f-15ec-8d10-fb0bbc909b57 2 +query +SELECT a_p3, COUNT(*) FROM (SELECT a AS a_p3 FROM t1 PARTITION(p3) UNION ALL SELECT CAST(a AS UUID) AS a_p3 FROM t2 PARTITION(p3)) td GROUP BY a_p3 +a_p3 COUNT(*) +9cfd306d-307f-15ec-8d10-090bbc909b57 2 +9cfd306d-307f-15ec-8d10-190bbc909b57 2 +9cfd306d-307f-15ec-8d10-240bbc909b57 2 +9cfd306d-307f-15ec-8d10-260bbc909b57 2 +9cfd306d-307f-15ec-8d10-270bbc909b57 2 +9cfd306d-307f-15ec-8d10-470bbc909b57 2 +9cfd306d-307f-15ec-8d10-490bbc909b57 2 +9cfd306d-307f-15ec-8d10-510bbc909b57 2 +9cfd306d-307f-15ec-8d10-5a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-5d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-640bbc909b57 2 +9cfd306d-307f-15ec-8d10-740bbc909b57 2 +9cfd306d-307f-15ec-8d10-770bbc909b57 2 +9cfd306d-307f-15ec-8d10-840bbc909b57 2 +9cfd306d-307f-15ec-8d10-860bbc909b57 2 +9cfd306d-307f-15ec-8d10-880bbc909b57 2 +9cfd306d-307f-15ec-8d10-8b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-990bbc909b57 2 +9cfd306d-307f-15ec-8d10-ad0bbc909b57 2 +9cfd306d-307f-15ec-8d10-b00bbc909b57 2 +9cfd306d-307f-15ec-8d10-b60bbc909b57 2 +9cfd306d-307f-15ec-8d10-b70bbc909b57 2 +9cfd306d-307f-15ec-8d10-c70bbc909b57 2 +9cfd306d-307f-15ec-8d10-ca0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b03 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b10 2 +9cfd306d-307f-16ec-8d10-d20bbc909b11 2 +9cfd306d-307f-16ec-8d10-d20bbc909b17 2 +9cfd306d-307f-16ec-8d10-d20bbc909b19 2 +9cfd306d-307f-16ec-8d10-d20bbc909b22 2 +9cfd306d-307f-16ec-8d10-d20bbc909b24 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b40 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b54 2 +9cfd306d-307f-16ec-8d10-d20bbc909b55 2 +9cfd306d-307f-14ec-8d02-d20bbc909b57 2 +03fd306d-307f-11ec-8d10-d20bbc909b57 2 +04fd306d-307f-11ec-8d10-d20bbc909b57 2 +11fd306d-307f-11ec-8d10-d20bbc909b57 2 +14fd306d-307f-11ec-8d10-d20bbc909b57 2 +1bfd306d-307f-11ec-8d10-d20bbc909b57 2 +21fd306d-307f-11ec-8d10-d20bbc909b57 2 +29fd306d-307f-11ec-8d10-d20bbc909b57 2 +2bfd306d-307f-11ec-8d10-d20bbc909b57 2 +38fd306d-307f-11ec-8d10-d20bbc909b57 2 +3bfd306d-307f-11ec-8d10-d20bbc909b57 2 +3efd306d-307f-11ec-8d10-d20bbc909b57 2 +51fd306d-307f-11ec-8d10-d20bbc909b57 2 +52fd306d-307f-11ec-8d10-d20bbc909b57 2 +5cfd306d-307f-11ec-8d10-d20bbc909b57 2 +60fd306d-307f-11ec-8d10-d20bbc909b57 2 +62fd306d-307f-11ec-8d10-d20bbc909b57 2 +66fd306d-307f-11ec-8d10-d20bbc909b57 2 +6efd306d-307f-11ec-8d10-d20bbc909b57 2 +75fd306d-307f-11ec-8d10-d20bbc909b57 2 +83fd306d-307f-11ec-8d10-d20bbc909b57 2 +97fd306d-307f-11ec-8d10-d20bbc909b57 2 +a1fd306d-307f-11ec-8d10-d20bbc909b57 2 +adfd306d-307f-11ec-8d10-d20bbc909b57 2 +b7fd306d-307f-11ec-8d10-d20bbc909b57 2 +b8fd306d-307f-11ec-8d10-d20bbc909b57 2 +b9fd306d-307f-11ec-8d10-d20bbc909b57 2 +bcfd306d-307f-11ec-8d10-d20bbc909b57 2 +c7fd306d-307f-11ec-8d10-d20bbc909b57 2 +d8fd306d-307f-11ec-8d10-d20bbc909b57 2 +dbfd306d-307f-11ec-8d10-d20bbc909b57 2 +ebfd306d-307f-11ec-8d10-d20bbc909b57 2 +eefd306d-307f-11ec-8d10-d20bbc909b57 2 +fdfd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-077f-12ec-8d10-d20bbc909b57 2 +9cfd306d-087f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-147f-12ec-8d10-d20bbc909b57 2 +9cfd306d-187f-12ec-8d10-d20bbc909b57 2 +9cfd306d-197f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-367f-12ec-8d10-d20bbc909b57 2 +9cfd306d-387f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-467f-12ec-8d10-d20bbc909b57 2 +9cfd306d-517f-12ec-8d10-d20bbc909b57 2 +9cfd306d-587f-12ec-8d10-d20bbc909b57 2 +9cfd306d-617f-12ec-8d10-d20bbc909b57 2 +9cfd306d-667f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-777f-12ec-8d10-d20bbc909b57 2 +9cfd306d-797f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-837f-12ec-8d10-d20bbc909b57 2 +9cfd306d-917f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-aa7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ad7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-bc7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-cb7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-cf7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-df7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fb7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fc7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1304-8d10-d20bbc909b57 2 +9cfd306d-307f-1310-8d10-d20bbc909b57 2 +9cfd306d-307f-1316-8d10-d20bbc909b57 2 +9cfd306d-307f-1317-8d10-d20bbc909b57 2 +9cfd306d-307f-131a-8d10-d20bbc909b57 2 +9cfd306d-307f-131b-8d10-d20bbc909b57 2 +9cfd306d-307f-131f-8d10-d20bbc909b57 2 +9cfd306d-307f-132c-8d10-d20bbc909b57 2 +9cfd306d-307f-134a-8d10-d20bbc909b57 2 +9cfd306d-307f-134c-8d10-d20bbc909b57 2 +9cfd306d-307f-134f-8d10-d20bbc909b57 2 +9cfd306d-307f-1358-8d10-d20bbc909b57 2 +9cfd306d-307f-1360-8d10-d20bbc909b57 2 +9cfd306d-307f-1365-8d10-d20bbc909b57 2 +9cfd306d-307f-1371-8d10-d20bbc909b57 2 +9cfd306d-307f-137a-8d10-d20bbc909b57 2 +9cfd306d-307f-1380-8d10-d20bbc909b57 2 +9cfd306d-307f-1384-8d10-d20bbc909b57 2 +9cfd306d-307f-1393-8d10-d20bbc909b57 2 +9cfd306d-307f-1395-8d10-d20bbc909b57 2 +9cfd306d-307f-139e-8d10-d20bbc909b57 2 +9cfd306d-307f-13a0-8d10-d20bbc909b57 2 +9cfd306d-307f-13a5-8d10-d20bbc909b57 2 +9cfd306d-307f-13a9-8d10-d20bbc909b57 2 +9cfd306d-307f-13ac-8d10-d20bbc909b57 2 +9cfd306d-307f-13ad-8d10-d20bbc909b57 2 +9cfd306d-307f-13c3-8d10-d20bbc909b57 2 +9cfd306d-307f-13cb-8d10-d20bbc909b57 2 +9cfd306d-307f-13d9-8d10-d20bbc909b57 2 +9cfd306d-307f-13dc-8d10-d20bbc909b57 2 +9cfd306d-307f-13e2-8d10-d20bbc909b57 2 +9cfd306d-307f-13e5-8d10-d20bbc909b57 2 +9cfd306d-307f-13ef-8d10-d20bbc909b57 2 +9cfd306d-307f-13f1-8d10-d20bbc909b57 2 +9cfd306d-307f-13f6-8d10-d20bbc909b57 2 +9cfd306d-307f-13fc-8d10-d20bbc909b57 2 +9cfd306d-307f-13fd-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d14-d20bbc909b57 2 +9cfd306d-307f-14ec-8d19-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d23-d20bbc909b57 2 +9cfd306d-307f-14ec-8d26-d20bbc909b57 2 +9cfd306d-307f-14ec-8d28-d20bbc909b57 2 +9cfd306d-307f-14ec-8d35-d20bbc909b57 2 +9cfd306d-307f-14ec-8d39-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d4b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d56-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d66-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d6f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d93-d20bbc909b57 2 +9cfd306d-307f-14ec-8dac-d20bbc909b57 2 +9cfd306d-307f-14ec-8daf-d20bbc909b57 2 +9cfd306d-307f-14ec-8db7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbb-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbe-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc2-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd9-d20bbc909b57 2 +9cfd306d-307f-14ec-8de7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dea-d20bbc909b57 2 +9cfd306d-307f-14ec-8deb-d20bbc909b57 2 +9cfd306d-307f-14ec-8df5-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfc-d20bbc909b57 2 +9cfd306d-307f-14ec-8dff-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b68 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b71 2 +9cfd306d-307f-16ec-8d10-d20bbc909b79 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b92 2 +9cfd306d-307f-16ec-8d10-d20bbc909b97 2 +9cfd306d-307f-16ec-8d10-d20bbc909b99 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9a 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba6 2 +9cfd306d-307f-16ec-8d10-d20bbc909baa 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bba 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc2 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bcd 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bde 2 +9cfd306d-307f-16ec-8d10-d20bbc909beb 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf6 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfe 2 +9cfd306d-307f-15ec-8d10-d70bbc909b57 2 +9cfd306d-307f-15ec-8d10-d80bbc909b57 2 +9cfd306d-307f-15ec-8d10-dd0bbc909b57 2 +9cfd306d-307f-15ec-8d10-de0bbc909b57 2 +9cfd306d-307f-15ec-8d10-e00bbc909b57 2 +9cfd306d-307f-15ec-8d10-ea0bbc909b57 2 +9cfd306d-307f-15ec-8d10-f60bbc909b57 2 +9cfd306d-307f-15ec-8d10-fa0bbc909b57 2 +9cfd306d-307f-15ec-8d10-fd0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ff0bbc909b57 2 +query +SELECT a_p4, COUNT(*) FROM (SELECT a AS a_p4 FROM t1 PARTITION(p4) UNION ALL SELECT CAST(a AS UUID) AS a_p4 FROM t2 PARTITION(p4)) td GROUP BY a_p4 +a_p4 COUNT(*) +9cfd306d-307f-15ec-8d10-000bbc909b57 2 +9cfd306d-307f-15ec-8d10-020bbc909b57 2 +9cfd306d-307f-15ec-8d10-030bbc909b57 2 +9cfd306d-307f-15ec-8d10-050bbc909b57 2 +9cfd306d-307f-15ec-8d10-220bbc909b57 2 +9cfd306d-307f-15ec-8d10-2c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-340bbc909b57 2 +9cfd306d-307f-15ec-8d10-370bbc909b57 2 +9cfd306d-307f-15ec-8d10-380bbc909b57 2 +9cfd306d-307f-15ec-8d10-3d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-440bbc909b57 2 +9cfd306d-307f-15ec-8d10-4a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-4d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-4f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-5c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-610bbc909b57 2 +9cfd306d-307f-15ec-8d10-6c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-6d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-6f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-710bbc909b57 2 +9cfd306d-307f-15ec-8d10-7c0bbc909b57 2 +9cfd306d-307f-15ec-8d10-800bbc909b57 2 +9cfd306d-307f-15ec-8d10-850bbc909b57 2 +9cfd306d-307f-15ec-8d10-890bbc909b57 2 +9cfd306d-307f-15ec-8d10-a50bbc909b57 2 +9cfd306d-307f-15ec-8d10-a90bbc909b57 2 +9cfd306d-307f-15ec-8d10-c90bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b00 2 +9cfd306d-307f-16ec-8d10-d20bbc909b06 2 +9cfd306d-307f-16ec-8d10-d20bbc909b07 2 +9cfd306d-307f-16ec-8d10-d20bbc909b09 2 +9cfd306d-307f-16ec-8d10-d20bbc909b14 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b25 2 +9cfd306d-307f-16ec-8d10-d20bbc909b28 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b32 2 +9cfd306d-307f-16ec-8d10-d20bbc909b41 2 +9cfd306d-307f-16ec-8d10-d20bbc909b50 2 +9cfd306d-307f-16ec-8d10-d20bbc909b52 2 +9cfd306d-307f-14ec-8d0f-d20bbc909b57 2 +0ffd306d-307f-11ec-8d10-d20bbc909b57 2 +15fd306d-307f-11ec-8d10-d20bbc909b57 2 +1dfd306d-307f-11ec-8d10-d20bbc909b57 2 +23fd306d-307f-11ec-8d10-d20bbc909b57 2 +24fd306d-307f-11ec-8d10-d20bbc909b57 2 +28fd306d-307f-11ec-8d10-d20bbc909b57 2 +2cfd306d-307f-11ec-8d10-d20bbc909b57 2 +2ffd306d-307f-11ec-8d10-d20bbc909b57 2 +35fd306d-307f-11ec-8d10-d20bbc909b57 2 +37fd306d-307f-11ec-8d10-d20bbc909b57 2 +43fd306d-307f-11ec-8d10-d20bbc909b57 2 +44fd306d-307f-11ec-8d10-d20bbc909b57 2 +49fd306d-307f-11ec-8d10-d20bbc909b57 2 +4dfd306d-307f-11ec-8d10-d20bbc909b57 2 +59fd306d-307f-11ec-8d10-d20bbc909b57 2 +63fd306d-307f-11ec-8d10-d20bbc909b57 2 +64fd306d-307f-11ec-8d10-d20bbc909b57 2 +67fd306d-307f-11ec-8d10-d20bbc909b57 2 +6afd306d-307f-11ec-8d10-d20bbc909b57 2 +70fd306d-307f-11ec-8d10-d20bbc909b57 2 +72fd306d-307f-11ec-8d10-d20bbc909b57 2 +79fd306d-307f-11ec-8d10-d20bbc909b57 2 +7afd306d-307f-11ec-8d10-d20bbc909b57 2 +81fd306d-307f-11ec-8d10-d20bbc909b57 2 +8afd306d-307f-11ec-8d10-d20bbc909b57 2 +8bfd306d-307f-11ec-8d10-d20bbc909b57 2 +96fd306d-307f-11ec-8d10-d20bbc909b57 2 +98fd306d-307f-11ec-8d10-d20bbc909b57 2 +a6fd306d-307f-11ec-8d10-d20bbc909b57 2 +abfd306d-307f-11ec-8d10-d20bbc909b57 2 +acfd306d-307f-11ec-8d10-d20bbc909b57 2 +b1fd306d-307f-11ec-8d10-d20bbc909b57 2 +b5fd306d-307f-11ec-8d10-d20bbc909b57 2 +bbfd306d-307f-11ec-8d10-d20bbc909b57 2 +bdfd306d-307f-11ec-8d10-d20bbc909b57 2 +bffd306d-307f-11ec-8d10-d20bbc909b57 2 +c0fd306d-307f-11ec-8d10-d20bbc909b57 2 +c4fd306d-307f-11ec-8d10-d20bbc909b57 2 +c6fd306d-307f-11ec-8d10-d20bbc909b57 2 +c9fd306d-307f-11ec-8d10-d20bbc909b57 2 +d1fd306d-307f-11ec-8d10-d20bbc909b57 2 +d6fd306d-307f-11ec-8d10-d20bbc909b57 2 +d9fd306d-307f-11ec-8d10-d20bbc909b57 2 +dafd306d-307f-11ec-8d10-d20bbc909b57 2 +e8fd306d-307f-11ec-8d10-d20bbc909b57 2 +eafd306d-307f-11ec-8d10-d20bbc909b57 2 +effd306d-307f-11ec-8d10-d20bbc909b57 2 +f5fd306d-307f-11ec-8d10-d20bbc909b57 2 +fbfd306d-307f-11ec-8d10-d20bbc909b57 2 +fcfd306d-307f-11ec-8d10-d20bbc909b57 2 +fefd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-017f-12ec-8d10-d20bbc909b57 2 +9cfd306d-067f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-107f-12ec-8d10-d20bbc909b57 2 +9cfd306d-167f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-217f-12ec-8d10-d20bbc909b57 2 +9cfd306d-237f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-327f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-417f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-4e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-507f-12ec-8d10-d20bbc909b57 2 +9cfd306d-597f-12ec-8d10-d20bbc909b57 2 +9cfd306d-607f-12ec-8d10-d20bbc909b57 2 +9cfd306d-627f-12ec-8d10-d20bbc909b57 2 +9cfd306d-637f-12ec-8d10-d20bbc909b57 2 +9cfd306d-677f-12ec-8d10-d20bbc909b57 2 +9cfd306d-697f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-737f-12ec-8d10-d20bbc909b57 2 +9cfd306d-767f-12ec-8d10-d20bbc909b57 2 +9cfd306d-7c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-827f-12ec-8d10-d20bbc909b57 2 +9cfd306d-847f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-997f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-af7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ba7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-be7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ce7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-db7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ee7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fa7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-fe7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1302-8d10-d20bbc909b57 2 +9cfd306d-307f-1303-8d10-d20bbc909b57 2 +9cfd306d-307f-1308-8d10-d20bbc909b57 2 +9cfd306d-307f-130d-8d10-d20bbc909b57 2 +9cfd306d-307f-130f-8d10-d20bbc909b57 2 +9cfd306d-307f-1311-8d10-d20bbc909b57 2 +9cfd306d-307f-1315-8d10-d20bbc909b57 2 +9cfd306d-307f-1318-8d10-d20bbc909b57 2 +9cfd306d-307f-1326-8d10-d20bbc909b57 2 +9cfd306d-307f-132f-8d10-d20bbc909b57 2 +9cfd306d-307f-1333-8d10-d20bbc909b57 2 +9cfd306d-307f-1342-8d10-d20bbc909b57 2 +9cfd306d-307f-1344-8d10-d20bbc909b57 2 +9cfd306d-307f-134b-8d10-d20bbc909b57 2 +9cfd306d-307f-134e-8d10-d20bbc909b57 2 +9cfd306d-307f-1350-8d10-d20bbc909b57 2 +9cfd306d-307f-1354-8d10-d20bbc909b57 2 +9cfd306d-307f-1357-8d10-d20bbc909b57 2 +9cfd306d-307f-1369-8d10-d20bbc909b57 2 +9cfd306d-307f-1370-8d10-d20bbc909b57 2 +9cfd306d-307f-1373-8d10-d20bbc909b57 2 +9cfd306d-307f-1378-8d10-d20bbc909b57 2 +9cfd306d-307f-1392-8d10-d20bbc909b57 2 +9cfd306d-307f-1397-8d10-d20bbc909b57 2 +9cfd306d-307f-139a-8d10-d20bbc909b57 2 +9cfd306d-307f-139d-8d10-d20bbc909b57 2 +9cfd306d-307f-13b2-8d10-d20bbc909b57 2 +9cfd306d-307f-13b7-8d10-d20bbc909b57 2 +9cfd306d-307f-13b9-8d10-d20bbc909b57 2 +9cfd306d-307f-13c1-8d10-d20bbc909b57 2 +9cfd306d-307f-13d2-8d10-d20bbc909b57 2 +9cfd306d-307f-13e3-8d10-d20bbc909b57 2 +9cfd306d-307f-13e8-8d10-d20bbc909b57 2 +9cfd306d-307f-13f0-8d10-d20bbc909b57 2 +9cfd306d-307f-13f2-8d10-d20bbc909b57 2 +9cfd306d-307f-13ff-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d13-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d24-d20bbc909b57 2 +9cfd306d-307f-14ec-8d29-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2e-d20bbc909b57 2 +9cfd306d-307f-14ec-8d2f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d34-d20bbc909b57 2 +9cfd306d-307f-14ec-8d3a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d41-d20bbc909b57 2 +9cfd306d-307f-14ec-8d46-d20bbc909b57 2 +9cfd306d-307f-14ec-8d55-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d60-d20bbc909b57 2 +9cfd306d-307f-14ec-8d69-d20bbc909b57 2 +9cfd306d-307f-14ec-8d70-d20bbc909b57 2 +9cfd306d-307f-14ec-8d73-d20bbc909b57 2 +9cfd306d-307f-14ec-8d77-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d80-d20bbc909b57 2 +9cfd306d-307f-14ec-8d85-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d90-d20bbc909b57 2 +9cfd306d-307f-14ec-8d91-d20bbc909b57 2 +9cfd306d-307f-14ec-8d98-d20bbc909b57 2 +9cfd306d-307f-14ec-8d99-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9d-d20bbc909b57 2 +9cfd306d-307f-14ec-8da2-d20bbc909b57 2 +9cfd306d-307f-14ec-8da4-d20bbc909b57 2 +9cfd306d-307f-14ec-8da8-d20bbc909b57 2 +9cfd306d-307f-14ec-8da9-d20bbc909b57 2 +9cfd306d-307f-14ec-8db1-d20bbc909b57 2 +9cfd306d-307f-14ec-8db6-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc0-d20bbc909b57 2 +9cfd306d-307f-14ec-8dca-d20bbc909b57 2 +9cfd306d-307f-14ec-8dcb-d20bbc909b57 2 +9cfd306d-307f-14ec-8ddf-d20bbc909b57 2 +9cfd306d-307f-14ec-8de0-d20bbc909b57 2 +9cfd306d-307f-14ec-8de4-d20bbc909b57 2 +9cfd306d-307f-14ec-8ded-d20bbc909b57 2 +9cfd306d-307f-14ec-8df3-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b76 2 +9cfd306d-307f-16ec-8d10-d20bbc909b84 2 +9cfd306d-307f-16ec-8d10-d20bbc909b85 2 +9cfd306d-307f-16ec-8d10-d20bbc909b88 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b9e 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba0 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc0 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc5 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bce 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd0 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd1 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd7 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bda 2 +9cfd306d-307f-16ec-8d10-d20bbc909bdb 2 +9cfd306d-307f-16ec-8d10-d20bbc909be4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf7 2 +9cfd306d-307f-15ec-8d10-d60bbc909b57 2 +9cfd306d-307f-15ec-8d10-d90bbc909b57 2 +9cfd306d-307f-15ec-8d10-e10bbc909b57 2 +9cfd306d-307f-15ec-8d10-e90bbc909b57 2 +9cfd306d-307f-15ec-8d10-f80bbc909b57 2 +query +SELECT a_p5, COUNT(*) FROM (SELECT a AS a_p5 FROM t1 PARTITION(p5) UNION ALL SELECT CAST(a AS UUID) AS a_p5 FROM t2 PARTITION(p5)) td GROUP BY a_p5 +a_p5 COUNT(*) +9cfd306d-307f-15ec-8d10-070bbc909b57 2 +9cfd306d-307f-15ec-8d10-0a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-0b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-140bbc909b57 2 +9cfd306d-307f-15ec-8d10-1b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-200bbc909b57 2 +9cfd306d-307f-15ec-8d10-210bbc909b57 2 +9cfd306d-307f-15ec-8d10-280bbc909b57 2 +9cfd306d-307f-15ec-8d10-2a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-2f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-360bbc909b57 2 +9cfd306d-307f-15ec-8d10-390bbc909b57 2 +9cfd306d-307f-15ec-8d10-3b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-3f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-410bbc909b57 2 +9cfd306d-307f-15ec-8d10-420bbc909b57 2 +9cfd306d-307f-15ec-8d10-4b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-4e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-590bbc909b57 2 +9cfd306d-307f-15ec-8d10-720bbc909b57 2 +9cfd306d-307f-15ec-8d10-760bbc909b57 2 +9cfd306d-307f-15ec-8d10-7f0bbc909b57 2 +9cfd306d-307f-15ec-8d10-810bbc909b57 2 +9cfd306d-307f-15ec-8d10-8d0bbc909b57 2 +9cfd306d-307f-15ec-8d10-960bbc909b57 2 +9cfd306d-307f-15ec-8d10-a10bbc909b57 2 +9cfd306d-307f-15ec-8d10-a30bbc909b57 2 +9cfd306d-307f-15ec-8d10-ab0bbc909b57 2 +9cfd306d-307f-15ec-8d10-ae0bbc909b57 2 +9cfd306d-307f-15ec-8d10-b10bbc909b57 2 +9cfd306d-307f-15ec-8d10-b20bbc909b57 2 +9cfd306d-307f-15ec-8d10-b30bbc909b57 2 +9cfd306d-307f-15ec-8d10-bb0bbc909b57 2 +9cfd306d-307f-15ec-8d10-be0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b01 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0a 2 +9cfd306d-307f-16ec-8d10-d20bbc909b0c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b15 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b1e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b20 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b33 2 +9cfd306d-307f-16ec-8d10-d20bbc909b36 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b48 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b53 2 +9cfd306d-307f-14ec-8d00-d20bbc909b57 2 +9cfd306d-307f-14ec-8d04-d20bbc909b57 2 +9cfd306d-307f-14ec-8d08-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0b-d20bbc909b57 2 +06fd306d-307f-11ec-8d10-d20bbc909b57 2 +0afd306d-307f-11ec-8d10-d20bbc909b57 2 +12fd306d-307f-11ec-8d10-d20bbc909b57 2 +18fd306d-307f-11ec-8d10-d20bbc909b57 2 +22fd306d-307f-11ec-8d10-d20bbc909b57 2 +27fd306d-307f-11ec-8d10-d20bbc909b57 2 +39fd306d-307f-11ec-8d10-d20bbc909b57 2 +41fd306d-307f-11ec-8d10-d20bbc909b57 2 +47fd306d-307f-11ec-8d10-d20bbc909b57 2 +4cfd306d-307f-11ec-8d10-d20bbc909b57 2 +56fd306d-307f-11ec-8d10-d20bbc909b57 2 +5dfd306d-307f-11ec-8d10-d20bbc909b57 2 +68fd306d-307f-11ec-8d10-d20bbc909b57 2 +6dfd306d-307f-11ec-8d10-d20bbc909b57 2 +77fd306d-307f-11ec-8d10-d20bbc909b57 2 +7dfd306d-307f-11ec-8d10-d20bbc909b57 2 +80fd306d-307f-11ec-8d10-d20bbc909b57 2 +84fd306d-307f-11ec-8d10-d20bbc909b57 2 +87fd306d-307f-11ec-8d10-d20bbc909b57 2 +90fd306d-307f-11ec-8d10-d20bbc909b57 2 +92fd306d-307f-11ec-8d10-d20bbc909b57 2 +95fd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-307f-11ec-8d10-d20bbc909b57 2 +9dfd306d-307f-11ec-8d10-d20bbc909b57 2 +a4fd306d-307f-11ec-8d10-d20bbc909b57 2 +a5fd306d-307f-11ec-8d10-d20bbc909b57 2 +a7fd306d-307f-11ec-8d10-d20bbc909b57 2 +a8fd306d-307f-11ec-8d10-d20bbc909b57 2 +a9fd306d-307f-11ec-8d10-d20bbc909b57 2 +b6fd306d-307f-11ec-8d10-d20bbc909b57 2 +cafd306d-307f-11ec-8d10-d20bbc909b57 2 +cefd306d-307f-11ec-8d10-d20bbc909b57 2 +d2fd306d-307f-11ec-8d10-d20bbc909b57 2 +e1fd306d-307f-11ec-8d10-d20bbc909b57 2 +e2fd306d-307f-11ec-8d10-d20bbc909b57 2 +ecfd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-1d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-257f-12ec-8d10-d20bbc909b57 2 +9cfd306d-337f-12ec-8d10-d20bbc909b57 2 +9cfd306d-457f-12ec-8d10-d20bbc909b57 2 +9cfd306d-477f-12ec-8d10-d20bbc909b57 2 +9cfd306d-487f-12ec-8d10-d20bbc909b57 2 +9cfd306d-497f-12ec-8d10-d20bbc909b57 2 +9cfd306d-557f-12ec-8d10-d20bbc909b57 2 +9cfd306d-577f-12ec-8d10-d20bbc909b57 2 +9cfd306d-647f-12ec-8d10-d20bbc909b57 2 +9cfd306d-687f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-6e7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-707f-12ec-8d10-d20bbc909b57 2 +9cfd306d-717f-12ec-8d10-d20bbc909b57 2 +9cfd306d-857f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8a7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ae7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-cd7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-dc7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-de7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e87f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ef7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f17f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-130a-8d10-d20bbc909b57 2 +9cfd306d-307f-1322-8d10-d20bbc909b57 2 +9cfd306d-307f-1323-8d10-d20bbc909b57 2 +9cfd306d-307f-1324-8d10-d20bbc909b57 2 +9cfd306d-307f-1328-8d10-d20bbc909b57 2 +9cfd306d-307f-132b-8d10-d20bbc909b57 2 +9cfd306d-307f-1346-8d10-d20bbc909b57 2 +9cfd306d-307f-1348-8d10-d20bbc909b57 2 +9cfd306d-307f-1352-8d10-d20bbc909b57 2 +9cfd306d-307f-1353-8d10-d20bbc909b57 2 +9cfd306d-307f-1359-8d10-d20bbc909b57 2 +9cfd306d-307f-135f-8d10-d20bbc909b57 2 +9cfd306d-307f-1366-8d10-d20bbc909b57 2 +9cfd306d-307f-1367-8d10-d20bbc909b57 2 +9cfd306d-307f-136b-8d10-d20bbc909b57 2 +9cfd306d-307f-1374-8d10-d20bbc909b57 2 +9cfd306d-307f-139b-8d10-d20bbc909b57 2 +9cfd306d-307f-13a4-8d10-d20bbc909b57 2 +9cfd306d-307f-13a8-8d10-d20bbc909b57 2 +9cfd306d-307f-13b6-8d10-d20bbc909b57 2 +9cfd306d-307f-13c5-8d10-d20bbc909b57 2 +9cfd306d-307f-13c6-8d10-d20bbc909b57 2 +9cfd306d-307f-13c7-8d10-d20bbc909b57 2 +9cfd306d-307f-13d4-8d10-d20bbc909b57 2 +9cfd306d-307f-13d5-8d10-d20bbc909b57 2 +9cfd306d-307f-13de-8d10-d20bbc909b57 2 +9cfd306d-307f-13e4-8d10-d20bbc909b57 2 +9cfd306d-307f-13ea-8d10-d20bbc909b57 2 +9cfd306d-307f-13f3-8d10-d20bbc909b57 2 +9cfd306d-307f-13f4-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d12-d20bbc909b57 2 +9cfd306d-307f-14ec-8d15-d20bbc909b57 2 +9cfd306d-307f-14ec-8d16-d20bbc909b57 2 +9cfd306d-307f-14ec-8d18-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d20-d20bbc909b57 2 +9cfd306d-307f-14ec-8d43-d20bbc909b57 2 +9cfd306d-307f-14ec-8d52-d20bbc909b57 2 +9cfd306d-307f-14ec-8d53-d20bbc909b57 2 +9cfd306d-307f-14ec-8d54-d20bbc909b57 2 +9cfd306d-307f-14ec-8d58-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d65-d20bbc909b57 2 +9cfd306d-307f-14ec-8d72-d20bbc909b57 2 +9cfd306d-307f-14ec-8d74-d20bbc909b57 2 +9cfd306d-307f-14ec-8d79-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d7f-d20bbc909b57 2 +9cfd306d-307f-14ec-8d83-d20bbc909b57 2 +9cfd306d-307f-14ec-8db3-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbc-d20bbc909b57 2 +9cfd306d-307f-14ec-8dbf-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc4-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc9-d20bbc909b57 2 +9cfd306d-307f-14ec-8dcd-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd2-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd5-d20bbc909b57 2 +9cfd306d-307f-14ec-8dde-d20bbc909b57 2 +9cfd306d-307f-14ec-8dec-d20bbc909b57 2 +9cfd306d-307f-14ec-8df0-d20bbc909b57 2 +9cfd306d-307f-14ec-8df2-d20bbc909b57 2 +9cfd306d-307f-14ec-8df4-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfa-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfe-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b5e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b60 2 +9cfd306d-307f-16ec-8d10-d20bbc909b66 2 +9cfd306d-307f-16ec-8d10-d20bbc909b67 2 +9cfd306d-307f-16ec-8d10-d20bbc909b77 2 +9cfd306d-307f-16ec-8d10-d20bbc909b8f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b93 2 +9cfd306d-307f-16ec-8d10-d20bbc909b98 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba1 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba4 2 +9cfd306d-307f-16ec-8d10-d20bbc909baf 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb2 2 +9cfd306d-307f-16ec-8d10-d20bbc909bb3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbe 2 +9cfd306d-307f-16ec-8d10-d20bbc909bcb 2 +9cfd306d-307f-16ec-8d10-d20bbc909bcc 2 +9cfd306d-307f-16ec-8d10-d20bbc909bdc 2 +9cfd306d-307f-16ec-8d10-d20bbc909be5 2 +9cfd306d-307f-16ec-8d10-d20bbc909be7 2 +9cfd306d-307f-16ec-8d10-d20bbc909be9 2 +9cfd306d-307f-16ec-8d10-d20bbc909bef 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf4 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf8 2 +9cfd306d-307f-16ec-8d10-d20bbc909bfd 2 +9cfd306d-307f-15ec-8d10-e50bbc909b57 2 +9cfd306d-307f-15ec-8d10-f20bbc909b57 2 +9cfd306d-307f-15ec-8d10-f40bbc909b57 2 +9cfd306d-307f-15ec-8d10-f50bbc909b57 2 +9cfd306d-307f-15ec-8d10-fc0bbc909b57 2 +query +SELECT a_p6, COUNT(*) FROM (SELECT a AS a_p6 FROM t1 PARTITION(p6) UNION ALL SELECT CAST(a AS UUID) AS a_p6 FROM t2 PARTITION(p6)) td GROUP BY a_p6 +a_p6 COUNT(*) +9cfd306d-307f-15ec-8d10-0e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-160bbc909b57 2 +9cfd306d-307f-15ec-8d10-170bbc909b57 2 +9cfd306d-307f-15ec-8d10-290bbc909b57 2 +9cfd306d-307f-15ec-8d10-2e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-350bbc909b57 2 +9cfd306d-307f-15ec-8d10-450bbc909b57 2 +9cfd306d-307f-15ec-8d10-540bbc909b57 2 +9cfd306d-307f-15ec-8d10-550bbc909b57 2 +9cfd306d-307f-15ec-8d10-5b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-600bbc909b57 2 +9cfd306d-307f-15ec-8d10-620bbc909b57 2 +9cfd306d-307f-15ec-8d10-670bbc909b57 2 +9cfd306d-307f-15ec-8d10-690bbc909b57 2 +9cfd306d-307f-15ec-8d10-6b0bbc909b57 2 +9cfd306d-307f-15ec-8d10-730bbc909b57 2 +9cfd306d-307f-15ec-8d10-7a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-870bbc909b57 2 +9cfd306d-307f-15ec-8d10-8a0bbc909b57 2 +9cfd306d-307f-15ec-8d10-9e0bbc909b57 2 +9cfd306d-307f-15ec-8d10-a60bbc909b57 2 +9cfd306d-307f-15ec-8d10-b40bbc909b57 2 +9cfd306d-307f-15ec-8d10-b50bbc909b57 2 +9cfd306d-307f-15ec-8d10-b90bbc909b57 2 +9cfd306d-307f-15ec-8d10-bd0bbc909b57 2 +9cfd306d-307f-15ec-8d10-bf0bbc909b57 2 +9cfd306d-307f-15ec-8d10-c80bbc909b57 2 +9cfd306d-307f-15ec-8d10-ce0bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b08 2 +9cfd306d-307f-16ec-8d10-d20bbc909b12 2 +9cfd306d-307f-16ec-8d10-d20bbc909b18 2 +9cfd306d-307f-16ec-8d10-d20bbc909b21 2 +9cfd306d-307f-16ec-8d10-d20bbc909b23 2 +9cfd306d-307f-16ec-8d10-d20bbc909b2c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b30 2 +9cfd306d-307f-16ec-8d10-d20bbc909b39 2 +9cfd306d-307f-16ec-8d10-d20bbc909b3b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b44 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b4c 2 +9cfd306d-307f-14ec-8d03-d20bbc909b57 2 +9cfd306d-307f-14ec-8d09-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0c-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d0e-d20bbc909b57 2 +01fd306d-307f-11ec-8d10-d20bbc909b57 2 +05fd306d-307f-11ec-8d10-d20bbc909b57 2 +0cfd306d-307f-11ec-8d10-d20bbc909b57 2 +1efd306d-307f-11ec-8d10-d20bbc909b57 2 +1ffd306d-307f-11ec-8d10-d20bbc909b57 2 +2efd306d-307f-11ec-8d10-d20bbc909b57 2 +30fd306d-307f-11ec-8d10-d20bbc909b57 2 +31fd306d-307f-11ec-8d10-d20bbc909b57 2 +3afd306d-307f-11ec-8d10-d20bbc909b57 2 +3cfd306d-307f-11ec-8d10-d20bbc909b57 2 +40fd306d-307f-11ec-8d10-d20bbc909b57 2 +4afd306d-307f-11ec-8d10-d20bbc909b57 2 +57fd306d-307f-11ec-8d10-d20bbc909b57 2 +5efd306d-307f-11ec-8d10-d20bbc909b57 2 +6cfd306d-307f-11ec-8d10-d20bbc909b57 2 +71fd306d-307f-11ec-8d10-d20bbc909b57 2 +74fd306d-307f-11ec-8d10-d20bbc909b57 2 +7bfd306d-307f-11ec-8d10-d20bbc909b57 2 +88fd306d-307f-11ec-8d10-d20bbc909b57 2 +8efd306d-307f-11ec-8d10-d20bbc909b57 2 +9ffd306d-307f-11ec-8d10-d20bbc909b57 2 +a0fd306d-307f-11ec-8d10-d20bbc909b57 2 +a2fd306d-307f-11ec-8d10-d20bbc909b57 2 +bafd306d-307f-11ec-8d10-d20bbc909b57 2 +befd306d-307f-11ec-8d10-d20bbc909b57 2 +c1fd306d-307f-11ec-8d10-d20bbc909b57 2 +c5fd306d-307f-11ec-8d10-d20bbc909b57 2 +c8fd306d-307f-11ec-8d10-d20bbc909b57 2 +cffd306d-307f-11ec-8d10-d20bbc909b57 2 +d7fd306d-307f-11ec-8d10-d20bbc909b57 2 +dffd306d-307f-11ec-8d10-d20bbc909b57 2 +e3fd306d-307f-11ec-8d10-d20bbc909b57 2 +e7fd306d-307f-11ec-8d10-d20bbc909b57 2 +e9fd306d-307f-11ec-8d10-d20bbc909b57 2 +f2fd306d-307f-11ec-8d10-d20bbc909b57 2 +fffd306d-307f-11ec-8d10-d20bbc909b57 2 +9cfd306d-027f-12ec-8d10-d20bbc909b57 2 +9cfd306d-0c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-157f-12ec-8d10-d20bbc909b57 2 +9cfd306d-1f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-287f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2d7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-2f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-397f-12ec-8d10-d20bbc909b57 2 +9cfd306d-3b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-427f-12ec-8d10-d20bbc909b57 2 +9cfd306d-567f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-5f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-877f-12ec-8d10-d20bbc909b57 2 +9cfd306d-887f-12ec-8d10-d20bbc909b57 2 +9cfd306d-8f7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-947f-12ec-8d10-d20bbc909b57 2 +9cfd306d-957f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9b7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-9c7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-a57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-b77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-bf7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-c57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ca7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-cc7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-d57f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e07f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e77f-12ec-8d10-d20bbc909b57 2 +9cfd306d-e97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-ed7f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f27f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f37f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f47f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f67f-12ec-8d10-d20bbc909b57 2 +9cfd306d-f97f-12ec-8d10-d20bbc909b57 2 +9cfd306d-307f-1301-8d10-d20bbc909b57 2 +9cfd306d-307f-1305-8d10-d20bbc909b57 2 +9cfd306d-307f-1306-8d10-d20bbc909b57 2 +9cfd306d-307f-1307-8d10-d20bbc909b57 2 +9cfd306d-307f-130c-8d10-d20bbc909b57 2 +9cfd306d-307f-1312-8d10-d20bbc909b57 2 +9cfd306d-307f-131d-8d10-d20bbc909b57 2 +9cfd306d-307f-1334-8d10-d20bbc909b57 2 +9cfd306d-307f-133c-8d10-d20bbc909b57 2 +9cfd306d-307f-133f-8d10-d20bbc909b57 2 +9cfd306d-307f-1343-8d10-d20bbc909b57 2 +9cfd306d-307f-1347-8d10-d20bbc909b57 2 +9cfd306d-307f-1349-8d10-d20bbc909b57 2 +9cfd306d-307f-135d-8d10-d20bbc909b57 2 +9cfd306d-307f-1362-8d10-d20bbc909b57 2 +9cfd306d-307f-1364-8d10-d20bbc909b57 2 +9cfd306d-307f-136d-8d10-d20bbc909b57 2 +9cfd306d-307f-1377-8d10-d20bbc909b57 2 +9cfd306d-307f-137b-8d10-d20bbc909b57 2 +9cfd306d-307f-137c-8d10-d20bbc909b57 2 +9cfd306d-307f-138b-8d10-d20bbc909b57 2 +9cfd306d-307f-1396-8d10-d20bbc909b57 2 +9cfd306d-307f-1399-8d10-d20bbc909b57 2 +9cfd306d-307f-13ae-8d10-d20bbc909b57 2 +9cfd306d-307f-13bd-8d10-d20bbc909b57 2 +9cfd306d-307f-13c4-8d10-d20bbc909b57 2 +9cfd306d-307f-13c9-8d10-d20bbc909b57 2 +9cfd306d-307f-13cc-8d10-d20bbc909b57 2 +9cfd306d-307f-13cd-8d10-d20bbc909b57 2 +9cfd306d-307f-13d7-8d10-d20bbc909b57 2 +9cfd306d-307f-13da-8d10-d20bbc909b57 2 +9cfd306d-307f-13dd-8d10-d20bbc909b57 2 +9cfd306d-307f-13e1-8d10-d20bbc909b57 2 +9cfd306d-307f-13e6-8d10-d20bbc909b57 2 +9cfd306d-307f-13ec-8d10-d20bbc909b57 2 +9cfd306d-307f-13ed-8d10-d20bbc909b57 2 +9cfd306d-307f-13ee-8d10-d20bbc909b57 2 +9cfd306d-307f-13f8-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d10-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1b-d20bbc909b57 2 +9cfd306d-307f-14ec-8d1d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d21-d20bbc909b57 2 +9cfd306d-307f-14ec-8d22-d20bbc909b57 2 +9cfd306d-307f-14ec-8d25-d20bbc909b57 2 +9cfd306d-307f-14ec-8d32-d20bbc909b57 2 +9cfd306d-307f-14ec-8d48-d20bbc909b57 2 +9cfd306d-307f-14ec-8d5d-d20bbc909b57 2 +9cfd306d-307f-14ec-8d62-d20bbc909b57 2 +9cfd306d-307f-14ec-8d64-d20bbc909b57 2 +9cfd306d-307f-14ec-8d71-d20bbc909b57 2 +9cfd306d-307f-14ec-8d84-d20bbc909b57 2 +9cfd306d-307f-14ec-8d8a-d20bbc909b57 2 +9cfd306d-307f-14ec-8d9a-d20bbc909b57 2 +9cfd306d-307f-14ec-8da1-d20bbc909b57 2 +9cfd306d-307f-14ec-8da7-d20bbc909b57 2 +9cfd306d-307f-14ec-8dae-d20bbc909b57 2 +9cfd306d-307f-14ec-8db0-d20bbc909b57 2 +9cfd306d-307f-14ec-8db2-d20bbc909b57 2 +9cfd306d-307f-14ec-8db8-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc1-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc3-d20bbc909b57 2 +9cfd306d-307f-14ec-8dc8-d20bbc909b57 2 +9cfd306d-307f-14ec-8dce-d20bbc909b57 2 +9cfd306d-307f-14ec-8dcf-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd0-d20bbc909b57 2 +9cfd306d-307f-14ec-8dd8-d20bbc909b57 2 +9cfd306d-307f-14ec-8ddb-d20bbc909b57 2 +9cfd306d-307f-14ec-8ddc-d20bbc909b57 2 +9cfd306d-307f-14ec-8de2-d20bbc909b57 2 +9cfd306d-307f-14ec-8de3-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfb-d20bbc909b57 2 +9cfd306d-307f-14ec-8dfd-d20bbc909b57 2 +9cfd306d-307f-16ec-8d10-d20bbc909b59 2 +9cfd306d-307f-16ec-8d10-d20bbc909b61 2 +9cfd306d-307f-16ec-8d10-d20bbc909b64 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6b 2 +9cfd306d-307f-16ec-8d10-d20bbc909b6c 2 +9cfd306d-307f-16ec-8d10-d20bbc909b74 2 +9cfd306d-307f-16ec-8d10-d20bbc909b75 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7d 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7e 2 +9cfd306d-307f-16ec-8d10-d20bbc909b7f 2 +9cfd306d-307f-16ec-8d10-d20bbc909b90 2 +9cfd306d-307f-16ec-8d10-d20bbc909b91 2 +9cfd306d-307f-16ec-8d10-d20bbc909ba5 2 +9cfd306d-307f-16ec-8d10-d20bbc909bbd 2 +9cfd306d-307f-16ec-8d10-d20bbc909bc1 2 +9cfd306d-307f-16ec-8d10-d20bbc909bd5 2 +9cfd306d-307f-16ec-8d10-d20bbc909be2 2 +9cfd306d-307f-16ec-8d10-d20bbc909be3 2 +9cfd306d-307f-16ec-8d10-d20bbc909bea 2 +9cfd306d-307f-16ec-8d10-d20bbc909bed 2 +9cfd306d-307f-16ec-8d10-d20bbc909bf5 2 +9cfd306d-307f-15ec-8d10-d50bbc909b57 2 +9cfd306d-307f-15ec-8d10-da0bbc909b57 2 +9cfd306d-307f-15ec-8d10-db0bbc909b57 2 +9cfd306d-307f-15ec-8d10-e60bbc909b57 2 +9cfd306d-307f-15ec-8d10-e70bbc909b57 2 +9cfd306d-307f-15ec-8d10-f00bbc909b57 2 +9cfd306d-307f-15ec-8d10-f30bbc909b57 2 +9cfd306d-307f-15ec-8d10-fe0bbc909b57 2 +CALL test_partition_by_key_pstat(7); +pname pcount +p0 213 +p1 212 +p2 216 +p3 216 +p4 240 +p5 213 +p6 226 +CALL test_partition_by_key_pstat(4); +pname pcount +p0 64 +p1 64 +p2 64 +p3 1344 +CALL test_partition_by_key_pstat(5); +pname pcount +p0 343 +p1 305 +p2 288 +p3 307 +p4 293 +CALL test_partition_by_key_pstat(6); +pname pcount +p0 47 +p1 469 +p2 38 +p3 451 +p4 43 +p5 488 +CALL test_partition_by_key_pstat(8); +pname pcount +p0 32 +p1 32 +p2 32 +p3 32 +p4 32 +p5 32 +p6 32 +p7 1312 +CALL test_partition_by_key_pstat(9); +pname pcount +p0 174 +p1 171 +p2 175 +p3 155 +p4 157 +p5 180 +p6 169 +p7 184 +p8 171 +CALL test_partition_by_key_pstat(10); +pname pcount +p0 23 +p1 283 +p2 31 +p3 282 +p4 27 +p5 320 +p6 22 +p7 257 +p8 25 +p9 266 +CALL test_partition_by_key_pstat(11); +pname pcount +p0 119 +p1 149 +p2 166 +p3 147 +p4 150 +p5 138 +p6 150 +p7 142 +p8 131 +p9 126 +p10 118 +CALL test_partition_by_key_pstat(12); +pname pcount +p0 23 +p1 21 +p2 19 +p3 435 +p4 22 +p5 27 +p6 24 +p7 448 +p8 19 +p9 16 +p10 21 +p11 461 +CALL test_partition_by_key_pstat(13); +pname pcount +p0 123 +p1 108 +p2 115 +p3 104 +p4 124 +p5 118 +p6 134 +p7 107 +p8 119 +p9 126 +p10 114 +p11 117 +p12 127 +CALL test_partition_by_key_pstat(14); +pname pcount +p0 17 +p1 200 +p2 22 +p3 194 +p4 21 +p5 193 +p6 14 +p7 196 +p8 12 +p9 194 +p10 22 +p11 219 +p12 20 +p13 212 +CALL test_partition_by_key_pstat(15); +pname pcount +p0 121 +p1 110 +p2 99 +p3 90 +p4 82 +p5 112 +p6 105 +p7 110 +p8 117 +p9 103 +p10 110 +p11 90 +p12 79 +p13 100 +p14 108 +CALL test_partition_by_key_pstat(16); +pname pcount +p0 16 +p1 16 +p2 16 +p3 16 +p4 16 +p5 16 +p6 16 +p7 1296 +p8 16 +p9 16 +p10 16 +p11 16 +p12 16 +p13 16 +p14 16 +p15 16 +DROP PROCEDURE test_partition_by_key_uuid_vs_binary; +DROP PROCEDURE test_partition_by_key_pstat; +DROP TABLE t0; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test new file mode 100644 index 00000000..5bd198c4 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_partition.test @@ -0,0 +1,104 @@ +--source include/have_partition.inc + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +SET NAMES utf8; + +--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR +CREATE TABLE t1 (a UUID) + PARTITION BY LIST COLUMNS(a) + (PARTITION p00 VALUES IN (10)); + +--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR +CREATE TABLE t1 (a UUID) + PARTITION BY LIST COLUMNS(a) + (PARTITION p00 VALUES IN (TIME'10:20:30')); + +--error ER_TRUNCATED_WRONG_VALUE +CREATE TABLE t1 (a UUID) + PARTITION BY LIST COLUMNS(a) + (PARTITION p00 VALUES IN ('€')); + +CREATE TABLE t1 (a UUID) + PARTITION BY LIST COLUMNS(a) + (PARTITION p00 VALUES IN ('123e4567-e89b-12d3-a456-426655440000'), + PARTITION pFF VALUES IN (0xffff000000000000000000000000ffff)); +INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440000'); +INSERT INTO t1 VALUES ('ffff0000-0000-0000-0000-00000000ffff'); +SELECT * FROM t1 PARTITION (p00); +SELECT * FROM t1 PARTITION (pFF); +DROP TABLE t1; + + +CREATE TABLE t0 (a UUID); +DELIMITER $$; +FOR i IN 0..255 +DO + INSERT INTO t0 VALUES (REPLACE('XXfd306d-307f-11ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-XX7f-12ec-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-13XX-8d10-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-14ec-8dXX-d20bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-15ec-8d10-XX0bbc909b57','XX',LPAD(HEX(i),2,'0'))); + INSERT INTO t0 VALUES (REPLACE('9cfd306d-307f-16ec-8d10-d20bbc909bXX','XX',LPAD(HEX(i),2,'0'))); +END FOR; +$$ +--echo # Test that UUID and BINARY(16) implement the same distribution by key +CREATE PROCEDURE test_partition_by_key_uuid_vs_binary(parts INT) +BEGIN + EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts); + EXECUTE IMMEDIATE REPLACE('CREATE TABLE t2 (a BINARY(16)) PARTITION BY KEY (a) PARTITIONS 7','7',parts); + INSERT INTO t1 SELECT * FROM t0; + INSERT INTO t2 SELECT * FROM t0; + FOR i IN 0..(parts-1) + DO + BEGIN + DECLARE query_template TEXT DEFAULT 'SELECT a_p0, COUNT(*) FROM (' + 'SELECT a AS a_p0 FROM t1 PARTITION(p0) ' + 'UNION ALL ' + 'SELECT CAST(a AS UUID) AS a_p0 FROM t2 PARTITION(p0)) td ' + 'GROUP BY a_p0'; + DECLARE query TEXT DEFAULT REPLACE(query_template,'p0',CONCAT('p',i)); + SELECT query; + EXECUTE IMMEDIATE query; + END; + END FOR; + DROP TABLE t1,t2; +END; +$$ +--echo # Display statistics how records are distributed between partitions +CREATE PROCEDURE test_partition_by_key_pstat(parts INT) +BEGIN + EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a UUID) PARTITION BY KEY (a) PARTITIONS 7','7',parts); + CREATE TABLE t1_pstat (pname VARCHAR(32), pcount int); + INSERT INTO t1 SELECT * FROM t0; + FOR i IN 0..(parts-1) + DO + BEGIN + DECLARE query_template TEXT DEFAULT 'INSERT INTO t1_pstat VALUES (''p0'',(SELECT COUNT(*) FROM t1 PARTITION (p0)))'; + EXECUTE IMMEDIATE REPLACE(query_template,'p0',CONCAT('p',i)); + END; + END FOR; + SELECT * FROM t1_pstat ORDER BY CAST(SUBSTR(pname,2,100) AS UNSIGNED); + DROP TABLE t1,t1_pstat; +END; +$$ +DELIMITER ;$$ +CALL test_partition_by_key_uuid_vs_binary(7); +CALL test_partition_by_key_pstat(7); +CALL test_partition_by_key_pstat(4); +CALL test_partition_by_key_pstat(5); +CALL test_partition_by_key_pstat(6); +CALL test_partition_by_key_pstat(8); +CALL test_partition_by_key_pstat(9); +CALL test_partition_by_key_pstat(10); +CALL test_partition_by_key_pstat(11); +CALL test_partition_by_key_pstat(12); +CALL test_partition_by_key_pstat(13); +CALL test_partition_by_key_pstat(14); +CALL test_partition_by_key_pstat(15); +CALL test_partition_by_key_pstat(16); +DROP PROCEDURE test_partition_by_key_uuid_vs_binary; +DROP PROCEDURE test_partition_by_key_pstat; +DROP TABLE t0; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result new file mode 100644 index 00000000..a8fc3ca2 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.result @@ -0,0 +1,31 @@ +# +# Start of 10.5 tests +# +# +# MDEV-4958 Adding datatype UUID +# +SELECT +PLUGIN_NAME, +PLUGIN_VERSION, +PLUGIN_STATUS, +PLUGIN_TYPE, +PLUGIN_AUTHOR, +PLUGIN_DESCRIPTION, +PLUGIN_LICENSE, +PLUGIN_MATURITY, +PLUGIN_AUTH_VERSION +FROM INFORMATION_SCHEMA.PLUGINS +WHERE PLUGIN_TYPE='DATA TYPE' + AND PLUGIN_NAME='uuid'; +PLUGIN_NAME uuid +PLUGIN_VERSION 1.0 +PLUGIN_STATUS ACTIVE +PLUGIN_TYPE DATA TYPE +PLUGIN_AUTHOR MariaDB Corporation +PLUGIN_DESCRIPTION Data type UUID +PLUGIN_LICENSE GPL +PLUGIN_MATURITY Stable +PLUGIN_AUTH_VERSION 1.0 +# +# End of 10.5 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.test new file mode 100644 index 00000000..112105a1 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_plugin.test @@ -0,0 +1,27 @@ +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +--vertical_results +SELECT + PLUGIN_NAME, + PLUGIN_VERSION, + PLUGIN_STATUS, + PLUGIN_TYPE, + PLUGIN_AUTHOR, + PLUGIN_DESCRIPTION, + PLUGIN_LICENSE, + PLUGIN_MATURITY, + PLUGIN_AUTH_VERSION +FROM INFORMATION_SCHEMA.PLUGINS + WHERE PLUGIN_TYPE='DATA TYPE' + AND PLUGIN_NAME='uuid'; +--horizontal_results + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.result new file mode 100644 index 00000000..09784df6 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.result @@ -0,0 +1,24 @@ +# +# Start of 10.5 tests +# +# +# MDEV-4958 Adding datatype UUID +# +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES +('123e4567-e89b-12d3-a456-426655440000'), +('123e4567-e89b-12d3-a456-426655440001'); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440002'); +SELECT * FROM t1 ORDER BY a; +a +123e4567-e89b-12d3-a456-426655440000 +123e4567-e89b-12d3-a456-426655440001 +123e4567-e89b-12d3-a456-426655440002 +DROP TABLE t1; +# +# End of 10.5 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.test new file mode 100644 index 00000000..1a39f813 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_stat_tables.test @@ -0,0 +1,22 @@ +--source include/have_stat_tables.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-4958 Adding datatype UUID +--echo # + +CREATE TABLE t1 (a UUID); +INSERT INTO t1 VALUES + ('123e4567-e89b-12d3-a456-426655440000'), + ('123e4567-e89b-12d3-a456-426655440001'); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +INSERT INTO t1 VALUES ('123e4567-e89b-12d3-a456-426655440002'); +SELECT * FROM t1 ORDER BY a; +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result new file mode 100644 index 00000000..e5d88c3d --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result @@ -0,0 +1,17 @@ +# +# Start of 10.7 tests +# +# +# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt() +# +CREATE TABLE t1 (i6 UUID, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe','09:43:12','uw'), (uuid(),'00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) +ffffffff-ffff-ffff-ffff-fffffffffffe +Warnings: +Warning 1292 Incorrect uuid value: 'a' +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test new file mode 100644 index 00000000..45cdf927 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test @@ -0,0 +1,17 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt() +--echo # + +CREATE TABLE t1 (i6 UUID, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe','09:43:12','uw'), (uuid(),'00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.7 tests +--echo # |