| 1 |
CREATE SEQUENCE a1 engine=aria; |
| 2 |
CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024; |
| 3 |
insert into t1 values (1),(2); |
| 4 |
CREATE SEQUENCE x1 engine=innodb; |
| 5 |
# dump whole database |
| 6 |
/*M!999999\- enable the sandbox mode */ |
| 7 |
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria; |
| 8 |
DO SETVAL(`a1`, 1, 0); |
| 9 |
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB; |
| 10 |
DO SETVAL(`x1`, 1, 0); |
| 11 |
/*!40101 SET @saved_cs_client = @@character_set_client */; |
| 12 |
/*!40101 SET character_set_client = utf8mb4 */; |
| 13 |
CREATE TABLE `t1` ( |
| 14 |
`a` int(11) DEFAULT NULL, |
| 15 |
KEY `a` (`a`) |
| 16 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci KEY_BLOCK_SIZE=1024; |
| 17 |
/*!40101 SET character_set_client = @saved_cs_client */; |
| 18 |
INSERT INTO `t1` VALUES |
| 19 |
(1), |
| 20 |
(2); |
| 21 |
# dump by tables order 1 |
| 22 |
/*M!999999\- enable the sandbox mode */ |
| 23 |
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria; |
| 24 |
DO SETVAL(`a1`, 1, 0); |
| 25 |
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB; |
| 26 |
DO SETVAL(`x1`, 1, 0); |
| 27 |
/*!40101 SET @saved_cs_client = @@character_set_client */; |
| 28 |
/*!40101 SET character_set_client = utf8mb4 */; |
| 29 |
CREATE TABLE `t1` ( |
| 30 |
`a` int(11) DEFAULT NULL, |
| 31 |
KEY `a` (`a`) |
| 32 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci KEY_BLOCK_SIZE=1024; |
| 33 |
/*!40101 SET character_set_client = @saved_cs_client */; |
| 34 |
INSERT INTO `t1` VALUES |
| 35 |
(1), |
| 36 |
(2); |
| 37 |
# dump by tables order 2 |
| 38 |
/*M!999999\- enable the sandbox mode */ |
| 39 |
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria; |
| 40 |
DO SETVAL(`a1`, 1, 0); |
| 41 |
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB; |
| 42 |
DO SETVAL(`x1`, 1, 0); |
| 43 |
/*!40101 SET @saved_cs_client = @@character_set_client */; |
| 44 |
/*!40101 SET character_set_client = utf8mb4 */; |
| 45 |
CREATE TABLE `t1` ( |
| 46 |
`a` int(11) DEFAULT NULL, |
| 47 |
KEY `a` (`a`) |
| 48 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci KEY_BLOCK_SIZE=1024; |
| 49 |
/*!40101 SET character_set_client = @saved_cs_client */; |
| 50 |
INSERT INTO `t1` VALUES |
| 51 |
(1), |
| 52 |
(2); |
| 53 |
# dump by tables only tables |
| 54 |
/*M!999999\- enable the sandbox mode */ |
| 55 |
/*!40101 SET @saved_cs_client = @@character_set_client */; |
| 56 |
/*!40101 SET character_set_client = utf8mb4 */; |
| 57 |
CREATE TABLE `t1` ( |
| 58 |
`a` int(11) DEFAULT NULL, |
| 59 |
KEY `a` (`a`) |
| 60 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci KEY_BLOCK_SIZE=1024; |
| 61 |
/*!40101 SET character_set_client = @saved_cs_client */; |
| 62 |
INSERT INTO `t1` VALUES |
| 63 |
(1), |
| 64 |
(2); |
| 65 |
# dump by tables only sequences |
| 66 |
/*M!999999\- enable the sandbox mode */ |
| 67 |
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria; |
| 68 |
DO SETVAL(`a1`, 1, 0); |
| 69 |
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB; |
| 70 |
DO SETVAL(`x1`, 1, 0); |
| 71 |
# end of dumps |
| 72 |
DROP TABLE a1,t1,x1; |
| 73 |
set default_storage_engine=InnoDB; |
| 74 |
create sequence t1; |
| 75 |
LOCK TABLES t1 READ; |
| 76 |
SELECT * FROM t1; |
| 77 |
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count |
| 78 |
1 1 9223372036854775806 1 1 1000 0 0 |
| 79 |
unlock tables; |
| 80 |
drop table t1; |
| 81 |
# |
| 82 |
# MDEV-28152 Features for sequence |
| 83 |
# |
| 84 |
CREATE DATABASE test1; |
| 85 |
CREATE DATABASE test2; |
| 86 |
USE test1; |
| 87 |
CREATE SEQUENCE s1 as tinyint; |
| 88 |
CREATE SEQUENCE s2 as smallint; |
| 89 |
CREATE SEQUENCE s3 as mediumint; |
| 90 |
CREATE SEQUENCE s4 as int; |
| 91 |
CREATE SEQUENCE s5 as bigint; |
| 92 |
CREATE SEQUENCE s6 as tinyint unsigned; |
| 93 |
CREATE SEQUENCE s7 as smallint unsigned; |
| 94 |
CREATE SEQUENCE s8 as mediumint unsigned; |
| 95 |
CREATE SEQUENCE s9 as int unsigned; |
| 96 |
CREATE SEQUENCE s10 as bigint unsigned; |
| 97 |
# Dump database 1 |
| 98 |
# Restore from database 1 to database 2 |
| 99 |
USE test2; |
| 100 |
SHOW CREATE SEQUENCE s1; |
| 101 |
Table Create Table |
| 102 |
s1 CREATE SEQUENCE `s1` as tinyint start with 1 minvalue 1 maxvalue 126 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 103 |
SHOW CREATE SEQUENCE s2; |
| 104 |
Table Create Table |
| 105 |
s2 CREATE SEQUENCE `s2` as smallint start with 1 minvalue 1 maxvalue 32766 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 106 |
SHOW CREATE SEQUENCE s3; |
| 107 |
Table Create Table |
| 108 |
s3 CREATE SEQUENCE `s3` as mediumint start with 1 minvalue 1 maxvalue 8388606 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 109 |
SHOW CREATE SEQUENCE s4; |
| 110 |
Table Create Table |
| 111 |
s4 CREATE SEQUENCE `s4` as int start with 1 minvalue 1 maxvalue 2147483646 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 112 |
SHOW CREATE SEQUENCE s5; |
| 113 |
Table Create Table |
| 114 |
s5 CREATE SEQUENCE `s5` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 115 |
SHOW CREATE SEQUENCE s6; |
| 116 |
Table Create Table |
| 117 |
s6 CREATE SEQUENCE `s6` as tinyint unsigned start with 1 minvalue 1 maxvalue 254 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 118 |
SHOW CREATE SEQUENCE s7; |
| 119 |
Table Create Table |
| 120 |
s7 CREATE SEQUENCE `s7` as smallint unsigned start with 1 minvalue 1 maxvalue 65534 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 121 |
SHOW CREATE SEQUENCE s8; |
| 122 |
Table Create Table |
| 123 |
s8 CREATE SEQUENCE `s8` as mediumint unsigned start with 1 minvalue 1 maxvalue 16777214 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 124 |
SHOW CREATE SEQUENCE s9; |
| 125 |
Table Create Table |
| 126 |
s9 CREATE SEQUENCE `s9` as int unsigned start with 1 minvalue 1 maxvalue 4294967294 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 127 |
SHOW CREATE SEQUENCE s10; |
| 128 |
Table Create Table |
| 129 |
s10 CREATE SEQUENCE `s10` as bigint unsigned start with 1 minvalue 1 maxvalue 18446744073709551614 increment by 1 cache 1000 nocycle ENGINE=InnoDB |
| 130 |
DROP DATABASE test1; |
| 131 |
DROP DATABASE test2; |
| 132 |
## test ORACLE mode |
| 133 |
set sql_mode=ORACLE; |
| 134 |
CREATE DATABASE test1; |
| 135 |
CREATE DATABASE test2; |
| 136 |
USE test1; |
| 137 |
CREATE SEQUENCE s1 as tinyint; |
| 138 |
CREATE SEQUENCE s2 as smallint; |
| 139 |
CREATE SEQUENCE s3 as mediumint; |
| 140 |
CREATE SEQUENCE s4 as int; |
| 141 |
CREATE SEQUENCE s5 as bigint; |
| 142 |
CREATE SEQUENCE s6 as tinyint unsigned; |
| 143 |
CREATE SEQUENCE s7 as smallint unsigned; |
| 144 |
CREATE SEQUENCE s8 as mediumint unsigned; |
| 145 |
CREATE SEQUENCE s9 as int unsigned; |
| 146 |
CREATE SEQUENCE s10 as bigint unsigned; |
| 147 |
# Dump database 1 |
| 148 |
# Restore from database 1 to database 2 |
| 149 |
USE test2; |
| 150 |
SHOW CREATE SEQUENCE s1; |
| 151 |
Table Create Table |
| 152 |
s1 CREATE SEQUENCE "s1" start with 1 minvalue 1 maxvalue 126 increment by 1 cache 1000 nocycle |
| 153 |
SHOW CREATE SEQUENCE s2; |
| 154 |
Table Create Table |
| 155 |
s2 CREATE SEQUENCE "s2" start with 1 minvalue 1 maxvalue 32766 increment by 1 cache 1000 nocycle |
| 156 |
SHOW CREATE SEQUENCE s3; |
| 157 |
Table Create Table |
| 158 |
s3 CREATE SEQUENCE "s3" start with 1 minvalue 1 maxvalue 8388606 increment by 1 cache 1000 nocycle |
| 159 |
SHOW CREATE SEQUENCE s4; |
| 160 |
Table Create Table |
| 161 |
s4 CREATE SEQUENCE "s4" start with 1 minvalue 1 maxvalue 2147483646 increment by 1 cache 1000 nocycle |
| 162 |
SHOW CREATE SEQUENCE s5; |
| 163 |
Table Create Table |
| 164 |
s5 CREATE SEQUENCE "s5" start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle |
| 165 |
SHOW CREATE SEQUENCE s6; |
| 166 |
Table Create Table |
| 167 |
s6 CREATE SEQUENCE "s6" start with 1 minvalue 1 maxvalue 254 increment by 1 cache 1000 nocycle |
| 168 |
SHOW CREATE SEQUENCE s7; |
| 169 |
Table Create Table |
| 170 |
s7 CREATE SEQUENCE "s7" start with 1 minvalue 1 maxvalue 65534 increment by 1 cache 1000 nocycle |
| 171 |
SHOW CREATE SEQUENCE s8; |
| 172 |
Table Create Table |
| 173 |
s8 CREATE SEQUENCE "s8" start with 1 minvalue 1 maxvalue 16777214 increment by 1 cache 1000 nocycle |
| 174 |
SHOW CREATE SEQUENCE s9; |
| 175 |
Table Create Table |
| 176 |
s9 CREATE SEQUENCE "s9" start with 1 minvalue 1 maxvalue 4294967294 increment by 1 cache 1000 nocycle |
| 177 |
SHOW CREATE SEQUENCE s10; |
| 178 |
Table Create Table |
| 179 |
s10 CREATE SEQUENCE "s10" start with 1 minvalue 1 maxvalue 18446744073709551614 increment by 1 cache 1000 nocycle |
| 180 |
DROP DATABASE test1; |
| 181 |
DROP DATABASE test2; |
| 182 |
set sql_mode=default; |
| 183 |
# |
| 184 |
# End of 11.5 tests |
| 185 |
# |