CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 2 cycle;
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 next value for t1;
next value for t1 1
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 30
select next value for t1;
next value for t1 2
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 30
select next value for t1;
next value for t1 3
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 50
select next value for t1;
next value for t1 4
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 50
select next value for t1;
next value for t1 5
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 70
select next value for t1;
next value for t1 6
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 70
select next value for t1;
next value for t1 7
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 90
select next value for t1;
next value for t1 8
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 90
select next value for t1;
next value for t1 9
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 110
select next value for t1;
next value for t1 10
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 110
select next value for t1;
next value for t1 1
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 31
select NEXT VALUE for t1,seq from seq_1_to_20;
NEXT VALUE for t1 seq 21 32 43 54 65 76 87 98 109 110 211 312 413 514 615 716 817 918 1019 120
drop sequence t1;
CREATE SEQUENCE t1 minvalue 1 maxvalue 10 increment by -1 cache 2 cycle engine=aria;
select next value for t1;
next value for t1 10
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 80
select next value for t1;
next value for t1 9
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 80
select next value for t1;
next value for t1 8
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 60
select next value for t1;
next value for t1 7
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 60
select next value for t1;
next value for t1 6
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 40
select next value for t1;
next value for t1 5
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 40
select next value for t1;
next value for t1 4
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 20
select next value for t1;
next value for t1 3
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 20
select next value for t1;
next value for t1 2
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 00
select next value for t1;
next value for t1 1
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 00
select next value for t1;
next value for t1 10
select next_not_cached_value,cycle_count from t1;
next_not_cached_value cycle_count 81
select NEXT VALUE for t1,seq from seq_1_to_20;
NEXT VALUE for t1 seq 91 82 73 64 55 46 37 28 19 1010 911 812 713 614 515 416 317 218 119 1020
drop sequence t1;
CREATE SEQUENCE t1 start with 8 minvalue 1 maxvalue 10 increment by 1 cache 2 nocycle;
select next value for t1;
next value for t1 8
select next value for t1;
next value for t1 9
select next value for t1;
next value for t1 10
select previous value for t1;
previous value for t1 10
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
select previous value for t1;
previous value for t1
NULL
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
drop sequence t1;
create sequence s1 start with 1 cache 2 maxvalue 5;
select next value for s1;
next value for s1 1
select next value for s1;
next value for s1 2
select next value for s1;
next value for s1 3
select next value for s1;
next value for s1 4
select next value for s1;
next value for s1 5
select next value for s1; ERROR HY000: Sequence 'test.s1' has run out
drop sequence s1;
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 100 increment by 1 cache 10;
select next value for t1;
next value for t1 1
select * from t1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 111100111000
flush tables;
select next value for t1;
next value for t1 11
select nextval(t1);
nextval(t1) 12
drop sequence t1;
CREATE SEQUENCE t9 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
select previous value for t9;
previous value for t9
NULL
select next value for t9;
next value for t9 1
select previous value for t9, lastval(t9);
previous value for t9 lastval(t9) 11
select next value for t9;
next value for t9 2
select previous value for t9, lastval(t9);
previous value for t9 lastval(t9) 22
select seq, previous value for t9, NEXT VALUE for t9, previous value for t9 from seq_1_to_20;
seq previous value for t9 NEXT VALUE for t9 previous value for t9 1233 2344 3455 4566 5677 6788 7899 891010 91011 10122 11233 12344 13455 14566 15677 16788 17899 1891010 191011 20122
select * from t9;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 611011512
drop sequence t9;
CREATE SEQUENCE s1 cache=0;
select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 11922337203685477580611000
select next value for s1;
next value for s1 1
select next_not_cached_value from s1;
next_not_cached_value 2
select next value for s1;
next value for s1 2
select next_not_cached_value from s1;
next_not_cached_value 3
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=1;
select next_not_cached_value from s1;
next_not_cached_value 1
select next value for s1;
next value for s1 1
select next_not_cached_value from s1;
next_not_cached_value 2
select next value for s1;
next value for s1 2
select next_not_cached_value from s1;
next_not_cached_value 3
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=2;
select next_not_cached_value from s1;
next_not_cached_value 1
select next value for s1;
next value for s1 1
select next_not_cached_value from s1;
next_not_cached_value 3
select next value for s1;
next value for s1 2
select next_not_cached_value from s1;
next_not_cached_value 3
DROP SEQUENCE s1;
CREATE SEQUENCE s1;
select next value for s1;
next value for s1 1
select next value for s1;
next value for s1 2
select next value for s1;
next value for s1 3
select next value for s1;
next value for s1 4
alter sequence s1 increment -2;
select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 1001192233720368547758061 -2100000
select next value for s1;
next value for s1 1001
select next value for s1;
next value for s1 999
alter sequence s1 restart 6;
select next value for s1;
next value for s1 6
select next value for s1;
next value for s1 4
select next value for s1;
next value for s1 2
select next value for s1; ERROR HY000: Sequence 'test.s1' has run out
DROP SEQUENCE s1;
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
select next value for t1;
next value for t1 1
select previous value for t1;
previous value for t1 1
flush tables;
select previous value for t1;
previous value for t1 1
drop sequence t1;
select previous value for t1; ERROR42S02: Unknown SEQUENCE: 't1'
CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
select previous value for t1;
previous value for t1
NULL
select next value for t1;
next value for t1 5
select previous value for t1;
previous value for t1 5
drop sequence t1;
CREATE orreplace SEQUENCE s1 MINVALUE 1 MAXVALUE 9999999999
INCREMENT BY 1 START WITH 3984356 CACHE 20 CYCLE engine=innodb;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
`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 s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 398435619999999999398435612010
select NEXT VALUE FOR s1;
NEXT VALUE FOR s1 3984356
select NEXT VALUE FOR s1;
NEXT VALUE FOR s1 3984357
select NEXT VALUE FOR s1;
NEXT VALUE FOR s1 3984358
select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 398437619999999999398435612010
FLUSH TABLES;
select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 398437619999999999398435612010
select NEXT VALUE FOR s1;
NEXT VALUE FOR s1 3984376
select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 398439619999999999398435612010
drop sequence s1;
CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
explain select next value for t1;
id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
explain select next value for t1, minimum_value from t1;
id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1
drop table t1;
CREATE SEQUENCE s1;
CREATE TABLE t1 (a int);
insert into t1 values (next value for s1);
insert into t1 values (next value for s1);
select * from t1;
a 1 2
drop table t1,s1;
CREATE SEQUENCE s1;
CREATE TABLE t1 (a int primary key auto_increment, b int default 0) engine=myisam;
insert into t1 values (),(),(),(),(),(),();
update t1 set b= next value for s1 where a <= 3;
select * from t1;
a b 11 22 33 40 50 60 70
drop table t1,s1;
CREATE ORREPLACE SEQUENCE s1 MINVALUE 1 MAXVALUE 9999999999 INCREMENT BY 1 START WITH 3984356nocache CYCLE engine='innodb';
select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 39843561999999999939843561010
select next value for s1;
next value for s1 3984356
explain extended select next value for s1;
id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select nextval(`test`.`s1`) AS `next value for s1`
explain extended select previous value for s1;
id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select lastval(`test`.`s1`) AS `previous value for s1`
drop sequence s1;
create table t1 (a int);
select next value for t1; ERROR42S02: 'test.t1' is not a SEQUENCE
drop table t1;
create sequence t1;
select next value for t1;
next value for t1 1
select next value for t1, minimum_value; ERROR42S22: Unknown column 'minimum_value' in 'SELECT'
drop sequence t1;
#
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
#
CREATE SEQUENCE s1;
SELECT
NEXT VALUE FOR s1,
PREVIOUS VALUE FOR s1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def NEXT VALUE FOR s1 8201 Y 32896063
def PREVIOUS VALUE FOR s1 8201 Y 32896063
NEXT VALUE FOR s1 PREVIOUS VALUE FOR s1 11
DROP SEQUENCE s1;
#
# MDEV-13720 ER_NOT_SEQUENCE for temporary table
#
create temporary table tmp (i int);
select next value for tmp; ERROR42S02: 'test.tmp' is not a SEQUENCE
drop table tmp;
#
# Test negative numbers
#
create sequence s start with 1 minvalue=-1000 maxvalue=1000 increment -1;
select next value for s;
next value for s 1
select next value for s;
next value for s 0
flush tables;
select next value for s;
next value for s
-999
drop sequence s;
#
# MDEV-23823 NEXT VALUE crash on locked view
#
CREATE VIEW v AS SELECT 1;
LOCK TABLE v READ;
SELECT NEXT VALUE FOR v; ERROR42S02: 'test.v' is not a SEQUENCE
#
# MDEV-24018: SIGSEGV in Item_func_nextval::update_table on SELECT SETVAL
#
SELECT SETVAL (v,0); ERROR42S02: 'test.v' is not a SEQUENCE
UNLOCK TABLES;
DROP VIEW v;
#
# MDEV-28650 Server crashes in Item_func_nextval::val_int after select from view
#
create sequence s;
create table t1 (a int not null default nextval(s));
insert into t1 values(),();
flush tables;
select default(a) from t1;
default(a) 1001 1002
create algorithm=merge view v1 as select default(a) from t1;
select * from v1;
default(a) 1003 1004
Select * from v1;
default(a) 1005 1006
prepare ps from 'SELECT * from v1';
execute ps;
default(a) 1007 1008
Execute ps;
default(a) 1009 1010
drop prepare ps;
create orreplace algorithm=temptable view v1 as select default(a) from t1;
select * from v1;
default(a) 1011 1012
Select * from v1;
default(a) 1013 1014
prepare ps from 'SELECT * from v1';
execute ps;
default(a) 1015 1016
Execute ps;
default(a) 1017 1018
drop prepare ps;
drop view v1;
drop table t1;
drop sequence s;
#
# MDEV-33985 Server crashes at Item_func_nextval::val_int
#
select * from (select 1 as a) x where (nextval(x)); ERROR42S02: Table 'test.x' doesn't exist
select (with x(x) as (select 1) select * from x where (nextval(x))); ERROR42S02: 'x' is not a SEQUENCE
create sequence s;
select next value for s1 from s as s1; ERROR42S02: Table 'test.s1' doesn't exist
drop sequence s;
#
# MDEV-38815 Server crashes in Item_func_nextval::val_int upon update on a view
#
create sequence s;
create table t (a int default(nextval(s)));
create view v as select * from t;
insert into t values (1);
update v set a= default;
drop view v;
drop table t;
drop sequence s;
#
# MDEV-39063 Server crashes at Item_func_lastval::val_int and Item_func_setval::val_int with CTE alias
#
create sequence s;
select (with x(x) as (select 1) select * from x where (lastval(x))); ERROR42S02: 'x' is not a SEQUENCE
drop sequence s;
create sequence s;
select (with x(x) as (select 1) select * from x where (setval(x,1))); ERROR42S02: 'x' is not a SEQUENCE
drop sequence s;
# End of 10.11 tests
#
# MDEV-28152 Features for sequence
#
create orreplace sequence t1 as tinyint unsigned minvalue 1 maxvalue 2;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` as tinyint unsigned start with 1 minvalue 1 maxvalue 2 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
select * from t1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 11211100000
select next value for t1;
next value for t1 1
select next value for t1;
next value for t1 2
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
create orreplace sequence t1 as tinyint unsigned minvalue 1 maxvalue 2 cycle;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` as tinyint unsigned start with 1 minvalue 1 maxvalue 2 increment by 1 cache 1000 cycle 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
select * from t1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 11211100010
select next value for t1;
next value for t1 1
select next value for t1;
next value for t1 2
select next value for t1;
next value for t1 1
create orreplace sequence t1 minvalue -23 maxvalue 99999 as tinyint;
Warnings:
Note 1292 Truncated incorrect INTEGER value: 'MAXVALUE'
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` as tinyint start with -23 minvalue -23 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
select * from t1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
-23 -23126 -231100000
select next value for t1;
next value for t1
-23
select next value for t1;
next value for t1
-22
select next value for t1;
next value for t1
-21
create orreplace sequence t1 as bigint unsigned start with 18446744073709551614;
select previous value for t1;
previous value for t1
NULL
select next value for t1;
next value for t1 18446744073709551614
select previous value for t1;
previous value for t1 18446744073709551614
create orreplace sequence t1 as tinyint start with 126;
select next value for t1;
next value for t1 126
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as tinyint unsigned start with 254;
select next value for t1;
next value for t1 254
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as smallint start with 32766;
select next value for t1;
next value for t1 32766
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as smallint unsigned start with 65534;
select next value for t1;
next value for t1 65534
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as mediumint start with 8388606;
select next value for t1;
next value for t1 8388606
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as mediumint unsigned start with 16777214;
select next value for t1;
next value for t1 16777214
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as int start with 2147483646;
select next value for t1;
next value for t1 2147483646
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as int unsigned start with 4294967294;
select next value for t1;
next value for t1 4294967294
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as bigint start with 9223372036854775806;
select next value for t1;
next value for t1 9223372036854775806
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as bigint unsigned start with 18446744073709551614;
select next value for t1;
next value for t1 18446744073709551614
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 1
create orreplace sequence t1 as tinyint start with -127 increment -1;
select next value for t1;
next value for t1
-127
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1
-1
create orreplace sequence t1 as tinyint unsigned start with 1 increment -1;
select next value for t1;
next value for t1 1
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 254
create orreplace sequence t1 as smallint start with -32767 increment -1;
select next value for t1;
next value for t1
-32767
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1
-1
create orreplace sequence t1 as smallint unsigned start with 1 increment -1;
select next value for t1;
next value for t1 1
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 65534
create orreplace sequence t1 as mediumint start with -8388607 increment -1;
select next value for t1;
next value for t1
-8388607
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1
-1
create orreplace sequence t1 as mediumint unsigned start with 1 increment -1;
select next value for t1;
next value for t1 1
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 16777214
create orreplace sequence t1 as int start with -2147483647 increment -1;
select next value for t1;
next value for t1
-2147483647
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1
-1
create orreplace sequence t1 as int unsigned start with 1 increment -1;
select next value for t1;
next value for t1 1
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 4294967294
create orreplace sequence t1 as bigint start with -9223372036854775807 increment -1;
select next value for t1;
next value for t1
-9223372036854775807
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1
-1
create orreplace sequence t1 as bigint unsigned start with 1 increment -1;
select next value for t1;
next value for t1 1
select next value for t1; ERROR HY000: Sequence 'test.t1' has run out
alter sequence t1 cycle;
select next value for t1;
next value for t1 18446744073709551614
drop sequence t1;
# End of 11.5 tests
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.