summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sql_sequence/create.result
blob: 5b8889933681c7cedc880b4cb57cfe1897edab1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
drop table if exists t1;
Warnings:
Note	1051	Unknown table 'test.t1'
create or replace sequence t1 engine=myisam;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
1	1	9223372036854775806	1	1	1000	0	0
create or replace sequence t1 engine=innodb;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
1	1	9223372036854775806	1	1	1000	0	0
create or replace sequence t1 engine=maria;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=Aria SEQUENCE=1
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
1	1	9223372036854775806	1	1	1000	0	0
create or replace sequence t1 engine=archive;
ERROR HY000: Table storage engine 'ARCHIVE' does not support the create option 'SEQUENCE'
show create table t1;
ERROR 42S02: Table 'test.t1' doesn't exist
create or replace sequence t1 start with 10;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 10 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
10	1	9223372036854775806	10	1	1000	0	0
create or replace sequence t1 minvalue=11;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 11 minvalue 11 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
11	11	9223372036854775806	11	1	1000	0	0
create or replace sequence t1 maxvalue=13 increment by -1;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 13 minvalue -9223372036854775807 maxvalue 13 increment by -1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
13	-9223372036854775807	13	13	-1	1000	0	0
create or replace sequence t1 increment by -1 cache 100;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with -1 minvalue -9223372036854775807 maxvalue -1 increment by -1 cache 100 nocycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
-1	-9223372036854775807	-1	-1	-1	100	0	0
create or replace sequence t1 cycle;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 cycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
1	1	9223372036854775806	1	1	1000	1	0
create or replace sequence t1 nocycle;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
1	1	9223372036854775806	1	1	1000	0	0
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 cycle minvalue= 14;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 14 minvalue 14 maxvalue 9223372036854775806 increment by 1 cache 1000 cycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
14	14	9223372036854775806	14	1	1000	1	0
create or replace sequence t1 cycle increment by -1;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with -1 minvalue -9223372036854775807 maxvalue -1 increment by -1 cache 1000 cycle ENGINE=MyISAM
drop sequence t1;
create sequence if not exists t1;
create sequence if not exists t1 start with 10;
Warnings:
Note	1050	Table 't1' already exists
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
1	1	9223372036854775806	1	1	1000	0	0
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 start with 10 minvalue=10 maxvalue=11 nocache cycle;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 10 minvalue 10 maxvalue 11 increment by 1 nocache cycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
10	10	11	10	1	0	1	0
create or replace sequence t1 start with 10 minvalue=-10 maxvalue=11 cache=10 cycle increment by 10;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 10 minvalue -10 maxvalue 11 increment by 10 cache 10 cycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
10	-10	11	10	10	10	1	0
create or replace sequence t1 start with 10 NO MAXVALUE NO MINVALUE;
create or replace sequence t1 start with 10 maxvalue 10;
create or replace sequence t1 start with 10 minvalue 10;
create or replace sequence t1 start with 10 minvalue 10 maxvalue 11 cycle;
create or replace sequence t1 start with 10 maxvalue=9223372036854775806;
create or replace sequence t1 start with 10 minvalue=-9223372036854775807;
drop sequence if exists t1;
create sequence t1 increment by 0;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 0 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
1	1	9223372036854775806	1	0	1000	0	0
drop sequence t1;
create table t1 (a int);
show create sequence t1;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence t1;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence if exists t1;
Warnings:
Note	4090	'test.t1' is not a SEQUENCE
create sequence t1 start with 10 maxvalue=9;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create sequence t1 minvalue= 100 maxvalue=10;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create sequence t1 start with 9 minvalue=10;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 maxvalue=13, increment by -1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' increment by -1' at line 1
create or replace sequence t1 start with= 10 maxvalue=13;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= 10 maxvalue=13' at line 1
create or replace sequence t1 maxvalue=13, increment= -1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' increment= -1' at line 1
create or replace sequence t1 start with 10 min_value=1 NO MINVALUE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NO MINVALUE' at line 1
create or replace sequence t1 start with 10 min_value=1 NO MINVALUE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NO MINVALUE' at line 1
create sequence t1 RESTART WITH 10;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RESTART' at line 1
create or replace sequence t1 start with 10 NO MINVALUE minvalue=1;
ERROR HY000: Option 'MINVALUE' used twice in statement
create sequence s increment by 3234567890123456789;
ERROR HY000: Sequence 'test.s' has out of range value for options
create or replace sequence t1;
show fields from t1;
Field	Type	Null	Key	Default	Extra
next_not_cached_value	bigint(21)	NO		NULL	
minimum_value	bigint(21)	NO		NULL	
maximum_value	bigint(21)	NO		NULL	
start_value	bigint(21)	NO		NULL	
increment	bigint(21)	NO		NULL	
cache_size	bigint(21) unsigned	NO		NULL	
cycle_option	tinyint(1) unsigned	NO		NULL	
cycle_count	bigint(21)	NO		NULL	
flush tables;
show fields from t1;
Field	Type	Null	Key	Default	Extra
next_not_cached_value	bigint(21)	NO		NULL	
minimum_value	bigint(21)	NO		NULL	
maximum_value	bigint(21)	NO		NULL	
start_value	bigint(21)	NO		NULL	
increment	bigint(21)	NO		NULL	
cache_size	bigint(21) unsigned	NO		NULL	
cycle_option	tinyint(1) unsigned	NO		NULL	
cycle_count	bigint(21)	NO		NULL	
create or replace sequence t1 engine=aria;
show fields from t1;
Field	Type	Null	Key	Default	Extra
next_not_cached_value	bigint(21)	NO		NULL	
minimum_value	bigint(21)	NO		NULL	
maximum_value	bigint(21)	NO		NULL	
start_value	bigint(21)	NO		NULL	
increment	bigint(21)	NO		NULL	
cache_size	bigint(21) unsigned	NO		NULL	
cycle_option	tinyint(1) unsigned	NO		NULL	
cycle_count	bigint(21)	NO		NULL	
show fields from t1;
Field	Type	Null	Key	Default	Extra
next_not_cached_value	bigint(21)	NO		NULL	
minimum_value	bigint(21)	NO		NULL	
maximum_value	bigint(21)	NO		NULL	
start_value	bigint(21)	NO		NULL	
increment	bigint(21)	NO		NULL	
cache_size	bigint(21) unsigned	NO		NULL	
cycle_option	tinyint(1) unsigned	NO		NULL	
cycle_count	bigint(21)	NO		NULL	
flush tables;
create or replace sequence t1 comment= "test 1";
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM COMMENT='test 1'
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1 COMMENT='test 1'
create or replace sequence t1 comment= "test 2" min_rows=1 max_rows=2;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM COMMENT='test 2'
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM MIN_ROWS=1 MAX_ROWS=2 SEQUENCE=1 COMMENT='test 2'
create or replace sequence t1 start=1 increment= 2;
create or replace sequence t1 start 1 increment 2;
create or replace sequence t1 cache +1;
drop sequence t1;
CREATE TABLE t1 (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL
) sequence=1;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL,
  `increment` bigint(21) NOT NULL,
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL,
  `cycle_count` bigint(21) NOT NULL
) ENGINE=MyISAM SEQUENCE=1
drop sequence t1;
CREATE OR REPLACE TABLE t1 (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count_not_exists` bigint(21) NOT NULL
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (cycle_count_not_exists)
CREATE OR REPLACE TABLE t1 (
`next_not_cached_value` int(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (minimum_value)
CREATE OR REPLACE TABLE t1 (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle` bigint(21) unsigned NOT NULL, /* error */
`cycle_count` bigint(21) NOT NULL
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (cycle)
CREATE OR REPLACE TABLE t1 (
`next_not_cached_value` bigint(21), /* error */
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (next_not_cached_value)
CREATE OR REPLACE TABLE t1 (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL,
extra_field bigint(21)
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (Wrong number of columns)
CREATE OR REPLACE TABLE t1 (
`minimum_value` bigint(21) NOT NULL,
`next_not_cached_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (minimum_value)
CREATE OR REPLACE TABLE t1 (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL,
key key1 (next_not_cached_value)
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys)
CREATE TABLE t1 (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL,
CHECK (start_value < minimum_value)
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any constraints)
CREATE TABLE t1 (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL CHECK (start_value < minimum_value),
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) NOT NULL
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (start_value)
CREATE TABLE t1 (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL,
`cycle_count` bigint(21) generated always as (1) virtual
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (cycle_count)
drop sequence if exists t1;
Warnings:
Note	4091	Unknown SEQUENCE: 'test.t1'
create sequence t1;
create sequence t2;
create table t3 (a int) engine=myisam;
select table_catalog, table_schema, table_name, table_type from information_schema.tables where table_catalog="test";
table_catalog	table_schema	table_name	table_type
CREATE SEQUENCE s1;
drop sequence s1;
drop sequence if exists t1,t2,t3,t4;
Warnings:
Note	4090	'test.t3' is not a SEQUENCE
Note	4091	Unknown SEQUENCE: 'test.t4'
drop table if exists t1,t2,t3;
Warnings:
Note	1051	Unknown table 'test.t1,test.t2'
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE SEQUENCE s1;
drop table t1,t2,s1;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE SEQUENCE s1;
drop table if exists t1,t2,s1,s2;
Warnings:
Note	1051	Unknown table 'test.s2'
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE SEQUENCE s1;
drop sequence t1,t2,s1,s2;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop table if exists t1,t2;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
CREATE SEQUENCE s1;
drop sequence if exists t1,t2,s1,s2;
Warnings:
Note	4090	'test.t1' is not a SEQUENCE
Note	4090	'test.t2' is not a SEQUENCE
Note	4091	Unknown SEQUENCE: 'test.s2'
drop table if exists t1,t2;
CREATE TEMPORARY SEQUENCE s1;
DROP SEQUENCE s1;
DROP TEMPORARY SEQUENCE s1;
ERROR 42S02: Unknown SEQUENCE: 'test.s1'
CREATE TEMPORARY SEQUENCE s1;
CREATE SEQUENCE s2;
CREATE TEMPORARY TABLE t1 (a int);
CREATE TABLE t2 (a int);
DROP TEMPORARY SEQUENCE t1,t2,s1,s2;
ERROR 42S02: Unknown SEQUENCE: 'test.t1,test.t2,test.s2'
DROP TEMPORARY SEQUENCE s1;
ERROR 42S02: Unknown SEQUENCE: 'test.s1'
DROP TEMPORARY TABLE t1;
DROP TABLE t1,t2,s1,s2;
ERROR 42S02: Unknown table 'test.t1,test.s1'
create view v1 as (select 1);
CREATE SEQUENCE s1;
DROP SEQUENCE s1,v1;
ERROR 42S02: 'test.v1' is a view
drop view v1;
CREATE TEMPORARY SEQUENCE t1;
select next value for t1;
next value for t1
1
drop temporary table t1;
select previous value for t1;
ERROR 42S02: Unknown SEQUENCE: 't1'
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10;
select next value for t1;
next value for t1
1
select previous value for t1;
previous value for t1
1
CREATE TEMPORARY SEQUENCE t1 start with 100 minvalue 100 maxvalue 200 increment by 1 cache 10;
select previous value for t1;
previous value for t1
NULL
select next value for t1;
next value for t1
100
select previous value for t1;
previous value for t1
100
drop temporary sequence t1;
select previous value for t1;
previous value for t1
1
drop sequence t1;
CREATE TEMPORARY SEQUENCE t1 engine=innodb;
select next value for t1;
next value for t1
1
drop temporary table t1;
select previous value for t1;
ERROR 42S02: Unknown SEQUENCE: 't1'
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10 engine=innodb;
select next value for t1;
next value for t1
1
select previous value for t1;
previous value for t1
1
CREATE TEMPORARY SEQUENCE t1 start with 100 minvalue 100 maxvalue 200 increment by 1 cache 10 engine=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
select previous value for t1;
previous value for t1
NULL
select next value for t1;
next value for t1
100
select previous value for t1;
previous value for t1
100
drop temporary sequence t1;
select previous value for t1;
previous value for t1
1
drop sequence t1;
create table t1 (a int) engine=sql_sequence;
ERROR 42000: Unknown storage engine 'sql_sequence'
#
# MDEV-13711 assertion on CREATE LIKE fix
#
create sequence s;
create table t like s;
show create table t;
Table	Create Table
t	CREATE TABLE `t` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
show create sequence t;
Table	Create Table
t	CREATE SEQUENCE `t` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
drop tables t, s;
#
# MDEV-13714 SEQUENCE option fix
#
create or replace table s (
`next_value` bigint(21) not null,
`min_value` bigint(21) not null,
`max_value` bigint(21) not null,
`start` bigint(21) not null,
`increment` bigint(21) not null,
`cache` bigint(21) not null,
`cycle` tinyint(1) unsigned not null,
`round` bigint(21) not null)
sequence=0;
create or replace table s2 (
`next_value` bigint(21) not null,
`min_value` bigint(21) not null,
`max_value` bigint(21) not null,
`start` bigint(21) not null,
`increment` bigint(21) not null,
`cache` bigint(21) not null,
`cycle` tinyint(1) unsigned not null,
`round` bigint(21) not null)
sequence=default;
show create table s;
Table	Create Table
s	CREATE TABLE `s` (
  `next_value` bigint(21) NOT NULL,
  `min_value` bigint(21) NOT NULL,
  `max_value` bigint(21) NOT NULL,
  `start` bigint(21) NOT NULL,
  `increment` bigint(21) NOT NULL,
  `cache` bigint(21) NOT NULL,
  `cycle` tinyint(1) unsigned NOT NULL,
  `round` bigint(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create table s2;
Table	Create Table
s2	CREATE TABLE `s2` (
  `next_value` bigint(21) NOT NULL,
  `min_value` bigint(21) NOT NULL,
  `max_value` bigint(21) NOT NULL,
  `start` bigint(21) NOT NULL,
  `increment` bigint(21) NOT NULL,
  `cache` bigint(21) NOT NULL,
  `cycle` tinyint(1) unsigned NOT NULL,
  `round` bigint(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create sequence s;
ERROR 42S02: 'test.s' is not a SEQUENCE
show create sequence s2;
ERROR 42S02: 'test.s2' is not a SEQUENCE
drop table s,s2;
#
# MDEV-13721 Assertion is_lock_owner() failed in mysql_rm_table_no_locks
#
create or replace sequence s;
create temporary table s (i int);
drop sequence s;
show create table s;
Table	Create Table
s	CREATE TEMPORARY TABLE `s` (
  `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table s;
create or replace sequence s;
create temporary sequence s;
show create table s;
Table	Create Table
s	CREATE TEMPORARY TABLE `s` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
drop sequence s;
show create table s;
Table	Create Table
s	CREATE TABLE `s` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
drop table s;
create or replace sequence s;
create temporary sequence s;
drop temporary sequence s;
show create table s;
Table	Create Table
s	CREATE TABLE `s` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
drop table s;
create temporary sequence s;
drop temporary table s;
create temporary table s (i int);
drop temporary sequence s;
ERROR 42S02: Unknown SEQUENCE: 'test.s'
drop table s;
#
# MDEV-15115 Assertion failure in CREATE SEQUENCE...ROW_FORMAT=REDUNDANT
#
CREATE SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME='test/seq1';
TABLE_ID	NAME	FLAG	N_COLS	SPACE	ROW_FORMAT	ZIP_PAGE_SIZE	SPACE_TYPE
#	test/seq1	12288	11	#	Redundant	0	Single
DROP SEQUENCE seq1;
CREATE TEMPORARY SEQUENCE seq1 ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
DROP TEMPORARY SEQUENCE seq1;
#
# MDEV-17503 CREATE SEQUENCE failed with innodb_force_primary_key =1
#
set global innodb_force_primary_key =1;
CREATE SEQUENCE s1 START WITH 100 INCREMENT BY 10 ENGINE=innodb;
set global innodb_force_primary_key=default;
ALTER TABLE s1 ADD PRIMARY KEY (next_not_cached_value);
ERROR HY000: Sequence 'test.s1' table structure is invalid (Sequence tables cannot have any keys)
DROP SEQUENCE s1;
#
# Beginning of 10.4 Test
#
# MDEV-13005: Fixing bugs in SEQUENCE, part 3
#
# Task 1:
SET @x = PREVIOUS VALUE FOR x;
ERROR 42S02: Unknown SEQUENCE: 'x'
# Task 2:
CREATE SEQUENCE x START WITH 1 INCREMENT BY 123456789012345678;
ERROR HY000: Sequence 'test.x' has out of range value for options
# Task 3:
CREATE SEQUENCE seq1 START WITH 1 cache -1;
ERROR HY000: Sequence 'test.seq1' has out of range value for options
# Task 4:
CREATE TEMPORARY TABLE s1 (s1 INT);
DROP TEMPORARY SEQUENCE s1;
ERROR 42S02: Unknown SEQUENCE: 'test.s1'
DROP TEMPORARY TABLE s1;
# Task 5:
CREATE TEMPORARY TABLE s1 (s1 INT);
CREATE TEMPORARY SEQUENCE s1 (s1 INT);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(s1 INT)' at line 1
DROP TEMPORARY TABLE s1;
# Task 6:
CREATE SEQUENCE seq1 START WITH 2;
CREATE TRIGGER s1 BEFORE UPDATE ON seq1 FOR EACH ROW SET @a= 5;
ERROR HY000: Trigger's 'seq1' is a view, temporary table or sequence
DROP SEQUENCE seq1;
# End of 10.4 test
######
# MDEV-28152 Features for sequence
######
# -----
# Truncating out-of-bound numbers for minvalue and maxvalue
# -----
create or replace sequence t1 minvalue -999999999999999999999;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MINVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with -9223372036854775807 minvalue -9223372036854775807 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 minvalue -9223372036854775808;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MINVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with -9223372036854775807 minvalue -9223372036854775807 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 minvalue -9223372036854775807;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with -9223372036854775807 minvalue -9223372036854775807 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 minvalue 9223372036854775805;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 9223372036854775805 minvalue 9223372036854775805 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 minvalue 9223372036854775806;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 minvalue 9223372036854775807;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 minvalue 9223372036854775808;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 minvalue 9999999999999999999999;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 maxvalue -999999999999999999999 increment by -1;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 maxvalue -9223372036854775808 increment by -1;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 maxvalue -9223372036854775807 increment by -1;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 maxvalue -9223372036854775806 increment by -1;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with -9223372036854775806 minvalue -9223372036854775807 maxvalue -9223372036854775806 increment by -1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 maxvalue 9223372036854775806;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 maxvalue 9223372036854775807;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 maxvalue 9223372036854775808;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 maxvalue 9999999999999999999999;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
# -----
# Create with value types
# -----
create or replace sequence t1 as tinyint;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as tinyint start with 1 minvalue 1 maxvalue 126 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` tinyint(5) NOT NULL,
  `minimum_value` tinyint(5) NOT NULL,
  `maximum_value` tinyint(5) NOT NULL,
  `start_value` tinyint(5) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as smallint;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as smallint start with 1 minvalue 1 maxvalue 32766 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` smallint(7) NOT NULL,
  `minimum_value` smallint(7) NOT NULL,
  `maximum_value` smallint(7) NOT NULL,
  `start_value` smallint(7) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as mediumint;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as mediumint start with 1 minvalue 1 maxvalue 8388606 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` mediumint(10) NOT NULL,
  `minimum_value` mediumint(10) NOT NULL,
  `maximum_value` mediumint(10) NOT NULL,
  `start_value` mediumint(10) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as int;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as int start with 1 minvalue 1 maxvalue 2147483646 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` int(12) NOT NULL,
  `minimum_value` int(12) NOT NULL,
  `maximum_value` int(12) NOT NULL,
  `start_value` int(12) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as bigint;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as tinyint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as tinyint unsigned start with 1 minvalue 1 maxvalue 254 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` tinyint(5) unsigned NOT NULL,
  `minimum_value` tinyint(5) unsigned NOT NULL,
  `maximum_value` tinyint(5) unsigned NOT NULL,
  `start_value` tinyint(5) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as smallint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as smallint unsigned start with 1 minvalue 1 maxvalue 65534 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` smallint(7) unsigned NOT NULL,
  `minimum_value` smallint(7) unsigned NOT NULL,
  `maximum_value` smallint(7) unsigned NOT NULL,
  `start_value` smallint(7) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as mediumint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as mediumint unsigned start with 1 minvalue 1 maxvalue 16777214 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` mediumint(10) unsigned NOT NULL,
  `minimum_value` mediumint(10) unsigned NOT NULL,
  `maximum_value` mediumint(10) unsigned NOT NULL,
  `start_value` mediumint(10) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as int unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as int unsigned start with 1 minvalue 1 maxvalue 4294967294 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` int(12) unsigned NOT NULL,
  `minimum_value` int(12) unsigned NOT NULL,
  `maximum_value` int(12) unsigned NOT NULL,
  `start_value` int(12) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as bigint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as bigint unsigned start with 1 minvalue 1 maxvalue 18446744073709551614 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) unsigned NOT NULL,
  `minimum_value` bigint(21) unsigned NOT NULL,
  `maximum_value` bigint(21) unsigned NOT NULL,
  `start_value` bigint(21) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as tinyint;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as tinyint start with -1 minvalue -127 maxvalue -1 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` tinyint(5) NOT NULL,
  `minimum_value` tinyint(5) NOT NULL,
  `maximum_value` tinyint(5) NOT NULL,
  `start_value` tinyint(5) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as smallint;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as smallint start with -1 minvalue -32767 maxvalue -1 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` smallint(7) NOT NULL,
  `minimum_value` smallint(7) NOT NULL,
  `maximum_value` smallint(7) NOT NULL,
  `start_value` smallint(7) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as mediumint;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as mediumint start with -1 minvalue -8388607 maxvalue -1 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` mediumint(10) NOT NULL,
  `minimum_value` mediumint(10) NOT NULL,
  `maximum_value` mediumint(10) NOT NULL,
  `start_value` mediumint(10) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as int;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as int start with -1 minvalue -2147483647 maxvalue -1 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` int(12) NOT NULL,
  `minimum_value` int(12) NOT NULL,
  `maximum_value` int(12) NOT NULL,
  `start_value` int(12) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as bigint;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with -1 minvalue -9223372036854775807 maxvalue -1 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as tinyint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as tinyint unsigned start with 254 minvalue 1 maxvalue 254 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` tinyint(5) unsigned NOT NULL,
  `minimum_value` tinyint(5) unsigned NOT NULL,
  `maximum_value` tinyint(5) unsigned NOT NULL,
  `start_value` tinyint(5) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as smallint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as smallint unsigned start with 65534 minvalue 1 maxvalue 65534 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` smallint(7) unsigned NOT NULL,
  `minimum_value` smallint(7) unsigned NOT NULL,
  `maximum_value` smallint(7) unsigned NOT NULL,
  `start_value` smallint(7) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as mediumint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as mediumint unsigned start with 16777214 minvalue 1 maxvalue 16777214 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` mediumint(10) unsigned NOT NULL,
  `minimum_value` mediumint(10) unsigned NOT NULL,
  `maximum_value` mediumint(10) unsigned NOT NULL,
  `start_value` mediumint(10) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as int unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as int unsigned start with 4294967294 minvalue 1 maxvalue 4294967294 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` int(12) unsigned NOT NULL,
  `minimum_value` int(12) unsigned NOT NULL,
  `maximum_value` int(12) unsigned NOT NULL,
  `start_value` int(12) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 increment -1 as bigint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as bigint unsigned start with 18446744073709551614 minvalue 1 maxvalue 18446744073709551614 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) unsigned NOT NULL,
  `minimum_value` bigint(21) unsigned NOT NULL,
  `maximum_value` bigint(21) unsigned NOT NULL,
  `start_value` bigint(21) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as tinyint zerofill;
ERROR HY000: Incorrect value 'ZEROFILL' for option 'AS'
create or replace sequence t1 as bigint unsigned start with 12345678901234567890;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as bigint unsigned start with 12345678901234567890 minvalue 1 maxvalue 18446744073709551614 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) unsigned NOT NULL,
  `minimum_value` bigint(21) unsigned NOT NULL,
  `maximum_value` bigint(21) unsigned NOT NULL,
  `start_value` bigint(21) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as bigint unsigned increment 12345678901234567;
ERROR HY000: Sequence 'test.t1' has out of range value for options
# -----
# value types + truncating
# -----
create or replace sequence t1 minvalue -23 maxvalue 9999 as tinyint unsigned;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MINVALUE'
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as tinyint unsigned start with 1 minvalue 1 maxvalue 254 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` tinyint(5) unsigned NOT NULL,
  `minimum_value` tinyint(5) unsigned NOT NULL,
  `maximum_value` tinyint(5) unsigned NOT NULL,
  `start_value` tinyint(5) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 minvalue -32768 maxvalue 32767 as smallint;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MINVALUE'
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as smallint start with -32767 minvalue -32767 maxvalue 32766 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` smallint(7) NOT NULL,
  `minimum_value` smallint(7) NOT NULL,
  `maximum_value` smallint(7) NOT NULL,
  `start_value` smallint(7) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 minvalue 0 maxvalue 65535 as smallint unsigned;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MINVALUE'
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as smallint unsigned start with 1 minvalue 1 maxvalue 65534 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` smallint(7) unsigned NOT NULL,
  `minimum_value` smallint(7) unsigned NOT NULL,
  `maximum_value` smallint(7) unsigned NOT NULL,
  `start_value` smallint(7) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 minvalue -12345678901234 as mediumint unsigned maxvalue 12345678901234;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MINVALUE'
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as mediumint unsigned start with 1 minvalue 1 maxvalue 16777214 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` mediumint(10) unsigned NOT NULL,
  `minimum_value` mediumint(10) unsigned NOT NULL,
  `maximum_value` mediumint(10) unsigned NOT NULL,
  `start_value` mediumint(10) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as bigint unsigned minvalue -12345678901234 maxvalue 12345678901234;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MINVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as bigint unsigned start with 1 minvalue 1 maxvalue 12345678901234 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) unsigned NOT NULL,
  `minimum_value` bigint(21) unsigned NOT NULL,
  `maximum_value` bigint(21) unsigned NOT NULL,
  `start_value` bigint(21) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
# -----
# indistinguishable values during parsing if we did not pass back Longlong_hybrid from the parser.
# -----
create or replace sequence t1 as bigint maxvalue -1 increment by -1;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with -1 minvalue -9223372036854775807 maxvalue -1 increment by -1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as bigint maxvalue 18446744073709551615;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) NOT NULL,
  `minimum_value` bigint(21) NOT NULL,
  `maximum_value` bigint(21) NOT NULL,
  `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
create or replace sequence t1 as bigint unsigned maxvalue -1;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 as bigint unsigned maxvalue 18446744073709551615;
Warnings:
Note	1292	Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as bigint unsigned start with 1 minvalue 1 maxvalue 18446744073709551614 increment by 1 cache 1000 nocycle ENGINE=MyISAM
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `next_not_cached_value` bigint(21) unsigned NOT NULL,
  `minimum_value` bigint(21) unsigned NOT NULL,
  `maximum_value` bigint(21) unsigned NOT NULL,
  `start_value` bigint(21) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache_size` bigint(21) unsigned NOT NULL,
  `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
  `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
# -----
# value types + out of range start
# -----
create or replace sequence t1 start with -123456789012345678901 as tinyint unsigned;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '123456789012345678901 as tinyint unsigned' at line 1
create or replace sequence t1 start with -1 as tinyint unsigned;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 start with 0 as tinyint unsigned;
ERROR HY000: Sequence 'test.t1' has out of range value for options
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as bigint unsigned start with 1 minvalue 1 maxvalue 18446744073709551614 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 start with 1 as tinyint unsigned;
show create sequence t1;
Table	Create Table
t1	CREATE SEQUENCE `t1` as tinyint unsigned start with 1 minvalue 1 maxvalue 254 increment by 1 cache 1000 nocycle ENGINE=MyISAM
create or replace sequence t1 start with 254 as tinyint unsigned;
create or replace sequence t1 start with 255 as tinyint unsigned;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 start with 256 as tinyint unsigned;
ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 start with 123456789012345678901 as tinyint unsigned;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '123456789012345678901 as tinyint unsigned' at line 1
drop sequence t1;
# -----
# information_schema.sequences
# -----
create sequence s1 as tinyint unsigned increment by 23;
create sequence s2 start with 42 minvalue -9223372036854775807;
create sequence s3 as bigint unsigned start with 12345678901234567890 cycle;
create sequence s4 as tinyint;
create sequence s5 as smallint;
create sequence s6 as mediumint;
create sequence s7 as int;
create sequence s8 as bigint;
create sequence s9 as tinyint unsigned;
create sequence s10 as smallint unsigned;
create sequence s11 as mediumint unsigned;
create sequence s12 as int unsigned;
create sequence s13 as bigint unsigned;
select * from information_schema.sequences order by sequence_name;
SEQUENCE_CATALOG	SEQUENCE_SCHEMA	SEQUENCE_NAME	DATA_TYPE	NUMERIC_PRECISION	NUMERIC_PRECISION_RADIX	NUMERIC_SCALE	START_VALUE	MINIMUM_VALUE	MAXIMUM_VALUE	INCREMENT	CYCLE_OPTION
def	test	s1	tinyint unsigned	8	2	0	1	1	254	23	0
def	test	s10	smallint unsigned	16	2	0	1	1	65534	1	0
def	test	s11	mediumint unsigned	24	2	0	1	1	16777214	1	0
def	test	s12	int unsigned	32	2	0	1	1	4294967294	1	0
def	test	s13	bigint unsigned	64	2	0	1	1	18446744073709551614	1	0
def	test	s2	bigint	64	2	0	42	-9223372036854775807	9223372036854775806	1	0
def	test	s3	bigint unsigned	64	2	0	12345678901234567890	1	18446744073709551614	1	1
def	test	s4	tinyint	8	2	0	1	1	126	1	0
def	test	s5	smallint	16	2	0	1	1	32766	1	0
def	test	s6	mediumint	24	2	0	1	1	8388606	1	0
def	test	s7	int	32	2	0	1	1	2147483646	1	0
def	test	s8	bigint	64	2	0	1	1	9223372036854775806	1	0
def	test	s9	tinyint unsigned	8	2	0	1	1	254	1	0
drop sequence s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;