Debian Codegraph @

mysql-test/suite/sql_sequence/next.result

raw
1 CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 2 cycle;
2 show create table t1;
3 Table Create Table
4 t1 CREATE TABLE `t1` (
5 `next_not_cached_value` bigint(21) NOT NULL,
6 `minimum_value` bigint(21) NOT NULL,
7 `maximum_value` bigint(21) NOT NULL,
8 `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
9 `increment` bigint(21) NOT NULL COMMENT 'increment value',
10 `cache_size` bigint(21) unsigned NOT NULL,
11 `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',
12 `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
13 ) ENGINE=MyISAM SEQUENCE=1
14 select next value for t1;
15 next value for t1
16 1
17 select next_not_cached_value,cycle_count from t1;
18 next_not_cached_value cycle_count
19 3 0
20 select next value for t1;
21 next value for t1
22 2
23 select next_not_cached_value,cycle_count from t1;
24 next_not_cached_value cycle_count
25 3 0
26 select next value for t1;
27 next value for t1
28 3
29 select next_not_cached_value,cycle_count from t1;
30 next_not_cached_value cycle_count
31 5 0
32 select next value for t1;
33 next value for t1
34 4
35 select next_not_cached_value,cycle_count from t1;
36 next_not_cached_value cycle_count
37 5 0
38 select next value for t1;
39 next value for t1
40 5
41 select next_not_cached_value,cycle_count from t1;
42 next_not_cached_value cycle_count
43 7 0
44 select next value for t1;
45 next value for t1
46 6
47 select next_not_cached_value,cycle_count from t1;
48 next_not_cached_value cycle_count
49 7 0
50 select next value for t1;
51 next value for t1
52 7
53 select next_not_cached_value,cycle_count from t1;
54 next_not_cached_value cycle_count
55 9 0
56 select next value for t1;
57 next value for t1
58 8
59 select next_not_cached_value,cycle_count from t1;
60 next_not_cached_value cycle_count
61 9 0
62 select next value for t1;
63 next value for t1
64 9
65 select next_not_cached_value,cycle_count from t1;
66 next_not_cached_value cycle_count
67 11 0
68 select next value for t1;
69 next value for t1
70 10
71 select next_not_cached_value,cycle_count from t1;
72 next_not_cached_value cycle_count
73 11 0
74 select next value for t1;
75 next value for t1
76 1
77 select next_not_cached_value,cycle_count from t1;
78 next_not_cached_value cycle_count
79 3 1
80 select NEXT VALUE for t1,seq from seq_1_to_20;
81 NEXT VALUE for t1 seq
82 2 1
83 3 2
84 4 3
85 5 4
86 6 5
87 7 6
88 8 7
89 9 8
90 10 9
91 1 10
92 2 11
93 3 12
94 4 13
95 5 14
96 6 15
97 7 16
98 8 17
99 9 18
100 10 19
101 1 20
102 drop sequence t1;
103 CREATE SEQUENCE t1 minvalue 1 maxvalue 10 increment by -1 cache 2 cycle engine=aria;
104 select next value for t1;
105 next value for t1
106 10
107 select next_not_cached_value,cycle_count from t1;
108 next_not_cached_value cycle_count
109 8 0
110 select next value for t1;
111 next value for t1
112 9
113 select next_not_cached_value,cycle_count from t1;
114 next_not_cached_value cycle_count
115 8 0
116 select next value for t1;
117 next value for t1
118 8
119 select next_not_cached_value,cycle_count from t1;
120 next_not_cached_value cycle_count
121 6 0
122 select next value for t1;
123 next value for t1
124 7
125 select next_not_cached_value,cycle_count from t1;
126 next_not_cached_value cycle_count
127 6 0
128 select next value for t1;
129 next value for t1
130 6
131 select next_not_cached_value,cycle_count from t1;
132 next_not_cached_value cycle_count
133 4 0
134 select next value for t1;
135 next value for t1
136 5
137 select next_not_cached_value,cycle_count from t1;
138 next_not_cached_value cycle_count
139 4 0
140 select next value for t1;
141 next value for t1
142 4
143 select next_not_cached_value,cycle_count from t1;
144 next_not_cached_value cycle_count
145 2 0
146 select next value for t1;
147 next value for t1
148 3
149 select next_not_cached_value,cycle_count from t1;
150 next_not_cached_value cycle_count
151 2 0
152 select next value for t1;
153 next value for t1
154 2
155 select next_not_cached_value,cycle_count from t1;
156 next_not_cached_value cycle_count
157 0 0
158 select next value for t1;
159 next value for t1
160 1
161 select next_not_cached_value,cycle_count from t1;
162 next_not_cached_value cycle_count
163 0 0
164 select next value for t1;
165 next value for t1
166 10
167 select next_not_cached_value,cycle_count from t1;
168 next_not_cached_value cycle_count
169 8 1
170 select NEXT VALUE for t1,seq from seq_1_to_20;
171 NEXT VALUE for t1 seq
172 9 1
173 8 2
174 7 3
175 6 4
176 5 5
177 4 6
178 3 7
179 2 8
180 1 9
181 10 10
182 9 11
183 8 12
184 7 13
185 6 14
186 5 15
187 4 16
188 3 17
189 2 18
190 1 19
191 10 20
192 drop sequence t1;
193 CREATE SEQUENCE t1 start with 8 minvalue 1 maxvalue 10 increment by 1 cache 2 nocycle;
194 select next value for t1;
195 next value for t1
196 8
197 select next value for t1;
198 next value for t1
199 9
200 select next value for t1;
201 next value for t1
202 10
203 select previous value for t1;
204 previous value for t1
205 10
206 select next value for t1;
207 ERROR HY000: Sequence 'test.t1' has run out
208 select previous value for t1;
209 previous value for t1
210 NULL
211 select next value for t1;
212 ERROR HY000: Sequence 'test.t1' has run out
213 drop sequence t1;
214 create sequence s1 start with 1 cache 2 maxvalue 5;
215 select next value for s1;
216 next value for s1
217 1
218 select next value for s1;
219 next value for s1
220 2
221 select next value for s1;
222 next value for s1
223 3
224 select next value for s1;
225 next value for s1
226 4
227 select next value for s1;
228 next value for s1
229 5
230 select next value for s1;
231 ERROR HY000: Sequence 'test.s1' has run out
232 drop sequence s1;
233 CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 100 increment by 1 cache 10;
234 select next value for t1;
235 next value for t1
236 1
237 select * from t1;
238 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
239 11 1 100 1 1 10 0 0
240 flush tables;
241 select next value for t1;
242 next value for t1
243 11
244 select nextval(t1);
245 nextval(t1)
246 12
247 drop sequence t1;
248 CREATE SEQUENCE t9 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
249 select previous value for t9;
250 previous value for t9
251 NULL
252 select next value for t9;
253 next value for t9
254 1
255 select previous value for t9, lastval(t9);
256 previous value for t9 lastval(t9)
257 1 1
258 select next value for t9;
259 next value for t9
260 2
261 select previous value for t9, lastval(t9);
262 previous value for t9 lastval(t9)
263 2 2
264 select seq, previous value for t9, NEXT VALUE for t9, previous value for t9 from seq_1_to_20;
265 seq previous value for t9 NEXT VALUE for t9 previous value for t9
266 1 2 3 3
267 2 3 4 4
268 3 4 5 5
269 4 5 6 6
270 5 6 7 7
271 6 7 8 8
272 7 8 9 9
273 8 9 10 10
274 9 10 1 1
275 10 1 2 2
276 11 2 3 3
277 12 3 4 4
278 13 4 5 5
279 14 5 6 6
280 15 6 7 7
281 16 7 8 8
282 17 8 9 9
283 18 9 10 10
284 19 10 1 1
285 20 1 2 2
286 select * from t9;
287 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
288 6 1 10 1 1 5 1 2
289 drop sequence t9;
290 CREATE SEQUENCE s1 cache=0;
291 select * from s1;
292 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
293 1 1 9223372036854775806 1 1 0 0 0
294 select next value for s1;
295 next value for s1
296 1
297 select next_not_cached_value from s1;
298 next_not_cached_value
299 2
300 select next value for s1;
301 next value for s1
302 2
303 select next_not_cached_value from s1;
304 next_not_cached_value
305 3
306 DROP SEQUENCE s1;
307 CREATE SEQUENCE s1 cache=1;
308 select next_not_cached_value from s1;
309 next_not_cached_value
310 1
311 select next value for s1;
312 next value for s1
313 1
314 select next_not_cached_value from s1;
315 next_not_cached_value
316 2
317 select next value for s1;
318 next value for s1
319 2
320 select next_not_cached_value from s1;
321 next_not_cached_value
322 3
323 DROP SEQUENCE s1;
324 CREATE SEQUENCE s1 cache=2;
325 select next_not_cached_value from s1;
326 next_not_cached_value
327 1
328 select next value for s1;
329 next value for s1
330 1
331 select next_not_cached_value from s1;
332 next_not_cached_value
333 3
334 select next value for s1;
335 next value for s1
336 2
337 select next_not_cached_value from s1;
338 next_not_cached_value
339 3
340 DROP SEQUENCE s1;
341 CREATE SEQUENCE s1;
342 select next value for s1;
343 next value for s1
344 1
345 select next value for s1;
346 next value for s1
347 2
348 select next value for s1;
349 next value for s1
350 3
351 select next value for s1;
352 next value for s1
353 4
354 alter sequence s1 increment -2;
355 select * from s1;
356 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
357 1001 1 9223372036854775806 1 -2 1000 0 0
358 select next value for s1;
359 next value for s1
360 1001
361 select next value for s1;
362 next value for s1
363 999
364 alter sequence s1 restart 6;
365 select next value for s1;
366 next value for s1
367 6
368 select next value for s1;
369 next value for s1
370 4
371 select next value for s1;
372 next value for s1
373 2
374 select next value for s1;
375 ERROR HY000: Sequence 'test.s1' has run out
376 DROP SEQUENCE s1;
377 CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
378 select next value for t1;
379 next value for t1
380 1
381 select previous value for t1;
382 previous value for t1
383 1
384 flush tables;
385 select previous value for t1;
386 previous value for t1
387 1
388 drop sequence t1;
389 select previous value for t1;
390 ERROR 42S02: Unknown SEQUENCE: 't1'
391 CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
392 select previous value for t1;
393 previous value for t1
394 NULL
395 select next value for t1;
396 next value for t1
397 5
398 select previous value for t1;
399 previous value for t1
400 5
401 drop sequence t1;
402 CREATE or replace SEQUENCE s1 MINVALUE 1 MAXVALUE 9999999999
403 INCREMENT BY 1 START WITH 3984356 CACHE 20 CYCLE engine=innodb;
404 show create table s1;
405 Table Create Table
406 s1 CREATE TABLE `s1` (
407 `next_not_cached_value` bigint(21) NOT NULL,
408 `minimum_value` bigint(21) NOT NULL,
409 `maximum_value` bigint(21) NOT NULL,
410 `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
411 `increment` bigint(21) NOT NULL COMMENT 'increment value',
412 `cache_size` bigint(21) unsigned NOT NULL,
413 `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',
414 `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
415 ) ENGINE=InnoDB SEQUENCE=1
416 select * from s1;
417 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
418 3984356 1 9999999999 3984356 1 20 1 0
419 select NEXT VALUE FOR s1;
420 NEXT VALUE FOR s1
421 3984356
422 select NEXT VALUE FOR s1;
423 NEXT VALUE FOR s1
424 3984357
425 select NEXT VALUE FOR s1;
426 NEXT VALUE FOR s1
427 3984358
428 select * from s1;
429 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
430 3984376 1 9999999999 3984356 1 20 1 0
431 FLUSH TABLES;
432 select * from s1;
433 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
434 3984376 1 9999999999 3984356 1 20 1 0
435 select NEXT VALUE FOR s1;
436 NEXT VALUE FOR s1
437 3984376
438 select * from s1;
439 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
440 3984396 1 9999999999 3984356 1 20 1 0
441 drop sequence s1;
442 CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
443 explain select next value for t1;
444 id select_type table type possible_keys key key_len ref rows Extra
445 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
446 explain select next value for t1, minimum_value from t1;
447 id select_type table type possible_keys key key_len ref rows Extra
448 1 SIMPLE t1 system NULL NULL NULL NULL 1
449 drop table t1;
450 CREATE SEQUENCE s1;
451 CREATE TABLE t1 (a int);
452 insert into t1 values (next value for s1);
453 insert into t1 values (next value for s1);
454 select * from t1;
455 a
456 1
457 2
458 drop table t1,s1;
459 CREATE SEQUENCE s1;
460 CREATE TABLE t1 (a int primary key auto_increment, b int default 0) engine=myisam;
461 insert into t1 values (),(),(),(),(),(),();
462 update t1 set b= next value for s1 where a <= 3;
463 select * from t1;
464 a b
465 1 1
466 2 2
467 3 3
468 4 0
469 5 0
470 6 0
471 7 0
472 drop table t1,s1;
473 CREATE OR REPLACE SEQUENCE s1 MINVALUE 1 MAXVALUE 9999999999 INCREMENT BY 1 START WITH 3984356 nocache CYCLE engine='innodb';
474 select * from s1;
475 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
476 3984356 1 9999999999 3984356 1 0 1 0
477 select next value for s1;
478 next value for s1
479 3984356
480 explain extended select next value for s1;
481 id select_type table type possible_keys key key_len ref rows filtered Extra
482 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
483 Warnings:
484 Note 1003 select nextval(`test`.`s1`) AS `next value for s1`
485 explain extended select previous value for s1;
486 id select_type table type possible_keys key key_len ref rows filtered Extra
487 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
488 Warnings:
489 Note 1003 select lastval(`test`.`s1`) AS `previous value for s1`
490 drop sequence s1;
491 create table t1 (a int);
492 select next value for t1;
493 ERROR 42S02: 'test.t1' is not a SEQUENCE
494 drop table t1;
495 create sequence t1;
496 select next value for t1;
497 next value for t1
498 1
499 select next value for t1, minimum_value;
500 ERROR 42S22: Unknown column 'minimum_value' in 'SELECT'
501 drop sequence t1;
502 #
503 # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
504 #
505 CREATE SEQUENCE s1;
506 SELECT
507 NEXT VALUE FOR s1,
508 PREVIOUS VALUE FOR s1;
509 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
510 def NEXT VALUE FOR s1 8 20 1 Y 32896 0 63
511 def PREVIOUS VALUE FOR s1 8 20 1 Y 32896 0 63
512 NEXT VALUE FOR s1 PREVIOUS VALUE FOR s1
513 1 1
514 DROP SEQUENCE s1;
515 #
516 # MDEV-13720 ER_NOT_SEQUENCE for temporary table
517 #
518 create temporary table tmp (i int);
519 select next value for tmp;
520 ERROR 42S02: 'test.tmp' is not a SEQUENCE
521 drop table tmp;
522 #
523 # Test negative numbers
524 #
525 create sequence s start with 1 minvalue=-1000 maxvalue=1000 increment -1;
526 select next value for s;
527 next value for s
528 1
529 select next value for s;
530 next value for s
531 0
532 flush tables;
533 select next value for s;
534 next value for s
535 -999
536 drop sequence s;
537 #
538 # MDEV-23823 NEXT VALUE crash on locked view
539 #
540 CREATE VIEW v AS SELECT 1;
541 LOCK TABLE v READ;
542 SELECT NEXT VALUE FOR v;
543 ERROR 42S02: 'test.v' is not a SEQUENCE
544 #
545 # MDEV-24018: SIGSEGV in Item_func_nextval::update_table on SELECT SETVAL
546 #
547 SELECT SETVAL (v,0);
548 ERROR 42S02: 'test.v' is not a SEQUENCE
549 UNLOCK TABLES;
550 DROP VIEW v;
551 #
552 # MDEV-28650 Server crashes in Item_func_nextval::val_int after select from view
553 #
554 create sequence s;
555 create table t1 (a int not null default nextval(s));
556 insert into t1 values(),();
557 flush tables;
558 select default(a) from t1;
559 default(a)
560 1001
561 1002
562 create algorithm=merge view v1 as select default(a) from t1;
563 select * from v1;
564 default(a)
565 1003
566 1004
567 Select * from v1;
568 default(a)
569 1005
570 1006
571 prepare ps from 'SELECT * from v1';
572 execute ps;
573 default(a)
574 1007
575 1008
576 Execute ps;
577 default(a)
578 1009
579 1010
580 drop prepare ps;
581 create or replace algorithm=temptable view v1 as select default(a) from t1;
582 select * from v1;
583 default(a)
584 1011
585 1012
586 Select * from v1;
587 default(a)
588 1013
589 1014
590 prepare ps from 'SELECT * from v1';
591 execute ps;
592 default(a)
593 1015
594 1016
595 Execute ps;
596 default(a)
597 1017
598 1018
599 drop prepare ps;
600 drop view v1;
601 drop table t1;
602 drop sequence s;
603 #
604 # MDEV-33985 Server crashes at Item_func_nextval::val_int
605 #
606 select * from (select 1 as a) x where (nextval(x));
607 ERROR 42S02: Table 'test.x' doesn't exist
608 select (with x(x) as (select 1) select * from x where (nextval(x)));
609 ERROR 42S02: 'x' is not a SEQUENCE
610 create sequence s;
611 select next value for s1 from s as s1;
612 ERROR 42S02: Table 'test.s1' doesn't exist
613 drop sequence s;
614 #
615 # MDEV-38815 Server crashes in Item_func_nextval::val_int upon update on a view
616 #
617 create sequence s;
618 create table t (a int default(nextval(s)));
619 create view v as select * from t;
620 insert into t values (1);
621 update v set a= default;
622 drop view v;
623 drop table t;
624 drop sequence s;
625 # End of 10.11 tests
626 #
627 # MDEV-28152 Features for sequence
628 #
629 create or replace sequence t1 as tinyint unsigned minvalue 1 maxvalue 2;
630 show create sequence t1;
631 Table Create Table
632 t1 CREATE SEQUENCE `t1` as tinyint unsigned start with 1 minvalue 1 maxvalue 2 increment by 1 cache 1000 nocycle ENGINE=MyISAM
633 show create table t1;
634 Table Create Table
635 t1 CREATE TABLE `t1` (
636 `next_not_cached_value` tinyint(5) unsigned NOT NULL,
637 `minimum_value` tinyint(5) unsigned NOT NULL,
638 `maximum_value` tinyint(5) unsigned NOT NULL,
639 `start_value` tinyint(5) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
640 `increment` bigint(21) NOT NULL COMMENT 'increment value',
641 `cache_size` bigint(21) unsigned NOT NULL,
642 `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',
643 `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
644 ) ENGINE=MyISAM SEQUENCE=1
645 select * from t1;
646 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
647 1 1 2 1 1 1000 0 0
648 select next value for t1;
649 next value for t1
650 1
651 select next value for t1;
652 next value for t1
653 2
654 select next value for t1;
655 ERROR HY000: Sequence 'test.t1' has run out
656 create or replace sequence t1 as tinyint unsigned minvalue 1 maxvalue 2 cycle;
657 show create sequence t1;
658 Table Create Table
659 t1 CREATE SEQUENCE `t1` as tinyint unsigned start with 1 minvalue 1 maxvalue 2 increment by 1 cache 1000 cycle ENGINE=MyISAM
660 show create table t1;
661 Table Create Table
662 t1 CREATE TABLE `t1` (
663 `next_not_cached_value` tinyint(5) unsigned NOT NULL,
664 `minimum_value` tinyint(5) unsigned NOT NULL,
665 `maximum_value` tinyint(5) unsigned NOT NULL,
666 `start_value` tinyint(5) unsigned NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
667 `increment` bigint(21) NOT NULL COMMENT 'increment value',
668 `cache_size` bigint(21) unsigned NOT NULL,
669 `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',
670 `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
671 ) ENGINE=MyISAM SEQUENCE=1
672 select * from t1;
673 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
674 1 1 2 1 1 1000 1 0
675 select next value for t1;
676 next value for t1
677 1
678 select next value for t1;
679 next value for t1
680 2
681 select next value for t1;
682 next value for t1
683 1
684 create or replace sequence t1 minvalue -23 maxvalue 99999 as tinyint;
685 Warnings:
686 Note 1292 Truncated incorrect INTEGER value: 'MAXVALUE'
687 show create sequence t1;
688 Table Create Table
689 t1 CREATE SEQUENCE `t1` as tinyint start with -23 minvalue -23 maxvalue 126 increment by 1 cache 1000 nocycle ENGINE=MyISAM
690 show create table t1;
691 Table Create Table
692 t1 CREATE TABLE `t1` (
693 `next_not_cached_value` tinyint(5) NOT NULL,
694 `minimum_value` tinyint(5) NOT NULL,
695 `maximum_value` tinyint(5) NOT NULL,
696 `start_value` tinyint(5) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
697 `increment` bigint(21) NOT NULL COMMENT 'increment value',
698 `cache_size` bigint(21) unsigned NOT NULL,
699 `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',
700 `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
701 ) ENGINE=MyISAM SEQUENCE=1
702 select * from t1;
703 next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
704 -23 -23 126 -23 1 1000 0 0
705 select next value for t1;
706 next value for t1
707 -23
708 select next value for t1;
709 next value for t1
710 -22
711 select next value for t1;
712 next value for t1
713 -21
714 create or replace sequence t1 as bigint unsigned start with 18446744073709551614;
715 select previous value for t1;
716 previous value for t1
717 NULL
718 select next value for t1;
719 next value for t1
720 18446744073709551614
721 select previous value for t1;
722 previous value for t1
723 18446744073709551614
724 create or replace sequence t1 as tinyint start with 126;
725 select next value for t1;
726 next value for t1
727 126
728 select next value for t1;
729 ERROR HY000: Sequence 'test.t1' has run out
730 alter sequence t1 cycle;
731 select next value for t1;
732 next value for t1
733 1
734 create or replace sequence t1 as tinyint unsigned start with 254;
735 select next value for t1;
736 next value for t1
737 254
738 select next value for t1;
739 ERROR HY000: Sequence 'test.t1' has run out
740 alter sequence t1 cycle;
741 select next value for t1;
742 next value for t1
743 1
744 create or replace sequence t1 as smallint start with 32766;
745 select next value for t1;
746 next value for t1
747 32766
748 select next value for t1;
749 ERROR HY000: Sequence 'test.t1' has run out
750 alter sequence t1 cycle;
751 select next value for t1;
752 next value for t1
753 1
754 create or replace sequence t1 as smallint unsigned start with 65534;
755 select next value for t1;
756 next value for t1
757 65534
758 select next value for t1;
759 ERROR HY000: Sequence 'test.t1' has run out
760 alter sequence t1 cycle;
761 select next value for t1;
762 next value for t1
763 1
764 create or replace sequence t1 as mediumint start with 8388606;
765 select next value for t1;
766 next value for t1
767 8388606
768 select next value for t1;
769 ERROR HY000: Sequence 'test.t1' has run out
770 alter sequence t1 cycle;
771 select next value for t1;
772 next value for t1
773 1
774 create or replace sequence t1 as mediumint unsigned start with 16777214;
775 select next value for t1;
776 next value for t1
777 16777214
778 select next value for t1;
779 ERROR HY000: Sequence 'test.t1' has run out
780 alter sequence t1 cycle;
781 select next value for t1;
782 next value for t1
783 1
784 create or replace sequence t1 as int start with 2147483646;
785 select next value for t1;
786 next value for t1
787 2147483646
788 select next value for t1;
789 ERROR HY000: Sequence 'test.t1' has run out
790 alter sequence t1 cycle;
791 select next value for t1;
792 next value for t1
793 1
794 create or replace sequence t1 as int unsigned start with 4294967294;
795 select next value for t1;
796 next value for t1
797 4294967294
798 select next value for t1;
799 ERROR HY000: Sequence 'test.t1' has run out
800 alter sequence t1 cycle;
801 select next value for t1;
802 next value for t1
803 1
804 create or replace sequence t1 as bigint start with 9223372036854775806;
805 select next value for t1;
806 next value for t1
807 9223372036854775806
808 select next value for t1;
809 ERROR HY000: Sequence 'test.t1' has run out
810 alter sequence t1 cycle;
811 select next value for t1;
812 next value for t1
813 1
814 create or replace sequence t1 as bigint unsigned start with 18446744073709551614;
815 select next value for t1;
816 next value for t1
817 18446744073709551614
818 select next value for t1;
819 ERROR HY000: Sequence 'test.t1' has run out
820 alter sequence t1 cycle;
821 select next value for t1;
822 next value for t1
823 1
824 create or replace sequence t1 as tinyint start with -127 increment -1;
825 select next value for t1;
826 next value for t1
827 -127
828 select next value for t1;
829 ERROR HY000: Sequence 'test.t1' has run out
830 alter sequence t1 cycle;
831 select next value for t1;
832 next value for t1
833 -1
834 create or replace sequence t1 as tinyint unsigned start with 1 increment -1;
835 select next value for t1;
836 next value for t1
837 1
838 select next value for t1;
839 ERROR HY000: Sequence 'test.t1' has run out
840 alter sequence t1 cycle;
841 select next value for t1;
842 next value for t1
843 254
844 create or replace sequence t1 as smallint start with -32767 increment -1;
845 select next value for t1;
846 next value for t1
847 -32767
848 select next value for t1;
849 ERROR HY000: Sequence 'test.t1' has run out
850 alter sequence t1 cycle;
851 select next value for t1;
852 next value for t1
853 -1
854 create or replace sequence t1 as smallint unsigned start with 1 increment -1;
855 select next value for t1;
856 next value for t1
857 1
858 select next value for t1;
859 ERROR HY000: Sequence 'test.t1' has run out
860 alter sequence t1 cycle;
861 select next value for t1;
862 next value for t1
863 65534
864 create or replace sequence t1 as mediumint start with -8388607 increment -1;
865 select next value for t1;
866 next value for t1
867 -8388607
868 select next value for t1;
869 ERROR HY000: Sequence 'test.t1' has run out
870 alter sequence t1 cycle;
871 select next value for t1;
872 next value for t1
873 -1
874 create or replace sequence t1 as mediumint unsigned start with 1 increment -1;
875 select next value for t1;
876 next value for t1
877 1
878 select next value for t1;
879 ERROR HY000: Sequence 'test.t1' has run out
880 alter sequence t1 cycle;
881 select next value for t1;
882 next value for t1
883 16777214
884 create or replace sequence t1 as int start with -2147483647 increment -1;
885 select next value for t1;
886 next value for t1
887 -2147483647
888 select next value for t1;
889 ERROR HY000: Sequence 'test.t1' has run out
890 alter sequence t1 cycle;
891 select next value for t1;
892 next value for t1
893 -1
894 create or replace sequence t1 as int unsigned start with 1 increment -1;
895 select next value for t1;
896 next value for t1
897 1
898 select next value for t1;
899 ERROR HY000: Sequence 'test.t1' has run out
900 alter sequence t1 cycle;
901 select next value for t1;
902 next value for t1
903 4294967294
904 create or replace sequence t1 as bigint start with -9223372036854775807 increment -1;
905 select next value for t1;
906 next value for t1
907 -9223372036854775807
908 select next value for t1;
909 ERROR HY000: Sequence 'test.t1' has run out
910 alter sequence t1 cycle;
911 select next value for t1;
912 next value for t1
913 -1
914 create or replace sequence t1 as bigint unsigned start with 1 increment -1;
915 select next value for t1;
916 next value for t1
917 1
918 select next value for t1;
919 ERROR HY000: Sequence 'test.t1' has run out
920 alter sequence t1 cycle;
921 select next value for t1;
922 next value for t1
923 18446744073709551614
924 drop sequence t1;
925 # End of 11.5 tests