summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sql_sequence
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-06-19 17:28:08 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-06-19 17:28:08 +0300
commit1e3886ae80c44a39ec3e4061b4ea3131cdcef213 (patch)
treece95518792d1432b669ba13a248928e74e81a9bb /mysql-test/suite/sql_sequence
parent0fe7d8a2a221196d977e5efe3f3dedb22806bb53 (diff)
parent3a7201ea922f6d3373924c413fdb4b108f6208c5 (diff)
downloadmariadb-git-1e3886ae80c44a39ec3e4061b4ea3131cdcef213.tar.gz
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'mysql-test/suite/sql_sequence')
-rw-r--r--mysql-test/suite/sql_sequence/alter.result30
-rw-r--r--mysql-test/suite/sql_sequence/alter.test2
-rw-r--r--mysql-test/suite/sql_sequence/aria.result2
-rw-r--r--mysql-test/suite/sql_sequence/binlog.result20
-rw-r--r--mysql-test/suite/sql_sequence/binlog.test8
-rw-r--r--mysql-test/suite/sql_sequence/create.result293
-rw-r--r--mysql-test/suite/sql_sequence/create.test115
-rw-r--r--mysql-test/suite/sql_sequence/gtid.result68
-rw-r--r--mysql-test/suite/sql_sequence/gtid.test4
-rw-r--r--mysql-test/suite/sql_sequence/mysqldump.result28
-rw-r--r--mysql-test/suite/sql_sequence/next.result172
-rw-r--r--mysql-test/suite/sql_sequence/next.test66
-rw-r--r--mysql-test/suite/sql_sequence/other.result40
-rw-r--r--mysql-test/suite/sql_sequence/other.test22
-rw-r--r--mysql-test/suite/sql_sequence/read_only.result13
-rw-r--r--mysql-test/suite/sql_sequence/read_only.test16
-rw-r--r--mysql-test/suite/sql_sequence/replication.result243
-rw-r--r--mysql-test/suite/sql_sequence/replication.test105
-rw-r--r--mysql-test/suite/sql_sequence/setval.result96
-rw-r--r--mysql-test/suite/sql_sequence/setval.test48
-rw-r--r--mysql-test/suite/sql_sequence/temporary.result12
-rw-r--r--mysql-test/suite/sql_sequence/temporary.test16
22 files changed, 746 insertions, 673 deletions
diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result
index bb57a704c11..76ebdeda0f7 100644
--- a/mysql-test/suite/sql_sequence/alter.result
+++ b/mysql-test/suite/sql_sequence/alter.result
@@ -6,7 +6,7 @@ Note 1051 Unknown table 'test.t1'
#
CREATE SEQUENCE t1 nocache engine=myisam;
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 0 0 0
select next value for t1;
next value for t1
@@ -16,7 +16,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 50 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
2 1 9223372036854775806 50 1 0 0 0
select next value for t1;
next value for t1
@@ -26,7 +26,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 50 minvalue -100 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 -100 9223372036854775806 50 1 0 0 0
alter sequence t1 minvalue=100 start=100;
ERROR HY000: Sequence 'test.t1' values are conflicting
@@ -35,14 +35,14 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 100 minvalue 100 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
100 100 9223372036854775806 100 1 0 0 0
alter sequence t1 maxvalue=500;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 100 minvalue 100 maxvalue 500 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
100 100 500 100 1 0 0 0
drop sequence t1;
CREATE SEQUENCE t1 engine=myisam;
@@ -64,7 +64,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 0 0 0
select next value for t1;
next value for t1
@@ -75,8 +75,8 @@ next value for t1
select next value for t1;
next value for t1
3
-select next_value, round from t1;
-next_value round
+select next_not_cached_value, cycle_count from t1;
+next_not_cached_value cycle_count
4 0
drop sequence t1;
CREATE SEQUENCE t1 maxvalue=100 engine=myisam;
@@ -85,7 +85,7 @@ 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_value min_value max_value start increment cache cycle round
+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
alter sequence t1 cycle;
show create sequence t1;
@@ -97,7 +97,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 15 minvalue 10 maxvalue 20 increment by 1 cache 1000 cycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
15 10 20 15 1 1000 1 0
select NEXT VALUE for t1 from seq_1_to_10;
NEXT VALUE for t1
@@ -131,7 +131,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 50 minvalue -100 maxvalue 100 increment by -2 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 -100 100 50 -2 1000 0 0
select NEXT VALUE for t1 from seq_1_to_10;
NEXT VALUE for t1
@@ -151,7 +151,7 @@ drop sequence t1;
CREATE SEQUENCE t1 cache 10 engine=innodb;
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 10 0 0
select next value for t1;
next value for t1
@@ -161,7 +161,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 100 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 10 nocycle ENGINE=InnoDB
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 9223372036854775806 100 1 10 0 0
select next value for t1;
next value for t1
@@ -195,7 +195,7 @@ 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 COMMENT='foo'
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3001 1 9223372036854775806 1 1 1000 0 0
drop sequence t1;
CREATE SEQUENCE t1 engine=myisam;
@@ -227,7 +227,7 @@ next value for t1
select next value for t1;
ERROR HY000: Sequence 'test.t1' has run out
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
0 1 100 50 -2 1000 0 0
alter sequence t1 restart;
select next value for t1;
diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test
index 584bb6f19aa..fd1809ccd2f 100644
--- a/mysql-test/suite/sql_sequence/alter.test
+++ b/mysql-test/suite/sql_sequence/alter.test
@@ -43,7 +43,7 @@ select * from t1;
select next value for t1;
select next value for t1;
select next value for t1;
-select next_value, round from t1;
+select next_not_cached_value, cycle_count from t1;
drop sequence t1;
CREATE SEQUENCE t1 maxvalue=100 engine=myisam;
diff --git a/mysql-test/suite/sql_sequence/aria.result b/mysql-test/suite/sql_sequence/aria.result
index 8bf45563a6f..b39d85d58ca 100644
--- a/mysql-test/suite/sql_sequence/aria.result
+++ b/mysql-test/suite/sql_sequence/aria.result
@@ -26,7 +26,7 @@ NEXT VALUE for t1 seq
19 19
20 20
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
21 1 9223372036854775806 1 1 10 0 0
drop sequence t1;
create sequence s1;
diff --git a/mysql-test/suite/sql_sequence/binlog.result b/mysql-test/suite/sql_sequence/binlog.result
index b4f772a204b..f01b3234e96 100644
--- a/mysql-test/suite/sql_sequence/binlog.result
+++ b/mysql-test/suite/sql_sequence/binlog.result
@@ -1,15 +1,15 @@
create or replace sequence s1 cache 3;
-select next value for s1, min_value from s1 where max_value> 1;
-next value for s1 min_value
+select next value for s1, minimum_value from s1 where maximum_value> 1;
+next value for s1 minimum_value
1 1
-select next value for s1, min_value from s1 where max_value> 2;
-next value for s1 min_value
+select next value for s1, minimum_value from s1 where maximum_value> 2;
+next value for s1 minimum_value
2 1
-select next value for s1, min_value from s1 where max_value> 3;
-next value for s1 min_value
+select next value for s1, minimum_value from s1 where maximum_value> 3;
+next value for s1 minimum_value
3 1
-select next value for s1, min_value from s1 where max_value> 4;
-next value for s1 min_value
+select next value for s1, minimum_value from s1 where maximum_value> 4;
+next value for s1 minimum_value
4 1
alter sequence s1 maxvalue 1000;
drop sequence s1;
@@ -18,12 +18,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create or replace sequence s1 cache 3
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # select next value for s1, min_value from s1 where max_value> 1
+master-bin.000001 # Annotate_rows # # select next value for s1, minimum_value from s1 where maximum_value> 1
master-bin.000001 # Table_map # # table_id: # (test.s1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # select next value for s1, min_value from s1 where max_value> 4
+master-bin.000001 # Annotate_rows # # select next value for s1, minimum_value from s1 where maximum_value> 4
master-bin.000001 # Table_map # # table_id: # (test.s1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
diff --git a/mysql-test/suite/sql_sequence/binlog.test b/mysql-test/suite/sql_sequence/binlog.test
index 56d835f05ca..5f2d52d7864 100644
--- a/mysql-test/suite/sql_sequence/binlog.test
+++ b/mysql-test/suite/sql_sequence/binlog.test
@@ -11,10 +11,10 @@ reset master; # get rid of previous tests binlog
--enable_query_log
create or replace sequence s1 cache 3;
-select next value for s1, min_value from s1 where max_value> 1;
-select next value for s1, min_value from s1 where max_value> 2;
-select next value for s1, min_value from s1 where max_value> 3;
-select next value for s1, min_value from s1 where max_value> 4;
+select next value for s1, minimum_value from s1 where maximum_value> 1;
+select next value for s1, minimum_value from s1 where maximum_value> 2;
+select next value for s1, minimum_value from s1 where maximum_value> 3;
+select next value for s1, minimum_value from s1 where maximum_value> 4;
#
# Alter sequence
diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result
index 4962752c7d9..d7492f9a22b 100644
--- a/mysql-test/suite/sql_sequence/create.result
+++ b/mysql-test/suite/sql_sequence/create.result
@@ -8,17 +8,17 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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_value min_value max_value start increment cache cycle round
+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;
@@ -27,17 +27,17 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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_value min_value max_value start increment cache cycle round
+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;
@@ -46,17 +46,17 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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_value min_value max_value start increment cache cycle round
+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'
@@ -67,42 +67,42 @@ 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_value min_value max_value start increment cache cycle round
+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_value min_value max_value start increment cache cycle round
+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_value min_value max_value start increment cache cycle round
+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_value min_value max_value start increment cache cycle round
+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_value min_value max_value start increment cache cycle round
+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_value min_value max_value start increment cache cycle round
+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
@@ -112,7 +112,7 @@ 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_value min_value max_value start increment cache cycle round
+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;
@@ -124,7 +124,7 @@ create sequence if not exists t1 start with 10;
Warnings:
Note 1050 Table 't1' already exists
select * from t1;
-next_value min_value max_value start increment cache cycle round
+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
@@ -134,14 +134,14 @@ 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_value min_value max_value start increment cache cycle round
+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_value min_value max_value start increment cache cycle round
+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;
@@ -155,12 +155,12 @@ 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_value min_value max_value start increment cache cycle round
+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 HY000: 'test.t1' is not SEQUENCE
+ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence t1;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence if exists t1;
@@ -193,46 +193,46 @@ drop sequence t1;
create sequence t1;
show fields from t1;
Field Type Null Key Default Extra
-next_value bigint(21) NO NULL
-min_value bigint(21) NO NULL
-max_value bigint(21) NO NULL
-start bigint(21) NO NULL
+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 bigint(21) NO NULL
-cycle tinyint(1) unsigned NO NULL
-round 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_value bigint(21) NO NULL
-min_value bigint(21) NO NULL
-max_value bigint(21) NO NULL
-start bigint(21) NO NULL
+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 bigint(21) NO NULL
-cycle tinyint(1) unsigned NO NULL
-round 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_value bigint(21) NO NULL
-min_value bigint(21) NO NULL
-max_value bigint(21) NO NULL
-start bigint(21) NO NULL
+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 bigint(21) NO NULL
-cycle tinyint(1) unsigned NO NULL
-round 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_value bigint(21) NO NULL
-min_value bigint(21) NO NULL
-max_value bigint(21) NO NULL
-start bigint(21) NO NULL
+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 bigint(21) NO NULL
-cycle tinyint(1) unsigned NO NULL
-round 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;
@@ -241,14 +241,14 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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;
@@ -257,27 +257,28 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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_value` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`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` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` 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
@@ -285,93 +286,93 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` 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_val` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`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` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` 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 (next_val)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (cycle_count_not_exists)
CREATE OR REPLACE TABLE t1 (
-`next_value` int(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`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` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` 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_value)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (next_not_cached_value)
CREATE OR REPLACE TABLE t1 (
-`next_val` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`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` bigint(21) NOT NULL,
+`cache_size` bigint(21) unsigned NOT NULL,
`cycle` bigint(21) unsigned NOT NULL, /* error */
-`round` bigint(21) NOT NULL
+`cycle_count` bigint(21) NOT NULL
) sequence=1;
-ERROR HY000: Sequence 'test.t1' table structure is invalid (next_val)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (cycle)
CREATE OR REPLACE TABLE t1 (
-`next_value` bigint(21),
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`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` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` 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_value)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (next_not_cached_value)
CREATE OR REPLACE TABLE t1 (
-`next_value` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`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` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` 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 (
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`next_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`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` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` 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 (min_value)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (minimum_value)
CREATE OR REPLACE TABLE t1 (
-`next_value` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`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` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` bigint(21) NOT NULL,
-key key1 (next_value)
+`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)
drop sequence if exists t1;
diff --git a/mysql-test/suite/sql_sequence/create.test b/mysql-test/suite/sql_sequence/create.test
index cf094c2cedd..23c32939efc 100644
--- a/mysql-test/suite/sql_sequence/create.test
+++ b/mysql-test/suite/sql_sequence/create.test
@@ -92,7 +92,7 @@ drop sequence t1;
#
create table t1 (a int);
---error ER_WRONG_OBJECT
+--error ER_NOT_SEQUENCE
show create sequence t1;
--error ER_NOT_SEQUENCE2
drop sequence t1;
@@ -149,6 +149,7 @@ show create sequence t1;
show create table t1;
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;
#
@@ -156,14 +157,14 @@ drop sequence t1;
#
CREATE TABLE t1 (
- `next_value` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` 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;
@@ -174,40 +175,40 @@ drop sequence t1;
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_val` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` 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;
# Wrong type
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_value` int(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` 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 ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_val` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
+ `cache_size` bigint(21) unsigned NOT NULL,
`cycle` bigint(21) unsigned NOT NULL, /* error */
- `round` bigint(21) NOT NULL
+ `cycle_count` bigint(21) NOT NULL
) sequence=1;
@@ -215,28 +216,28 @@ CREATE OR REPLACE TABLE t1 (
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_value` bigint(21),
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` 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;
# Extra field
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_value` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` 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;
@@ -244,29 +245,29 @@ CREATE OR REPLACE TABLE t1 (
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `next_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` 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;
# key
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_value` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `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` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL,
- key key1 (next_value)
+ `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;
drop sequence if exists t1;
diff --git a/mysql-test/suite/sql_sequence/gtid.result b/mysql-test/suite/sql_sequence/gtid.result
index ce8e8b7bb80..4c0a4e0e8fc 100644
--- a/mysql-test/suite/sql_sequence/gtid.result
+++ b/mysql-test/suite/sql_sequence/gtid.result
@@ -24,28 +24,28 @@ create sequence s1;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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
connection slave;
use s_db;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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
connection master;
use s_db;
@@ -161,13 +161,13 @@ priv test
connection m_normal_1;
create sequence s_db.s1;
select * from s_db.s1;
-next_value min_value max_value start increment cache cycle round
+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
select next value for s_db.s1;
next value for s_db.s1
1
select * from s_db.s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1001 1 9223372036854775806 1 1 1000 0 0
create sequence s_db.s2;
drop sequence s_db.s2;
@@ -250,20 +250,20 @@ connection slave;
connection s_normal_3;
use s_db;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 20 1 1 5 1 0
connection m_normal_1;
select next value for s_t;
next value for s_t
1
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
6 1 20 1 1 5 1 0
connection master;
connection slave;
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
6 1 20 1 1 5 1 0
------------------------------------------
master update nextval;
@@ -272,12 +272,12 @@ connection m_normal_1;
select next value for s_t;
next value for s_t
2
-update s_t set next_value= 11;
+update s_t set next_not_cached_value= 11;
ERROR HY000: Storage engine SEQUENCE of the table `s_db`.`s_t` doesn't have this option
alter sequence s_t restart=11;
commit;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 20 1 1 5 1 0
connection master;
connection slave;
@@ -286,29 +286,29 @@ show slave nextval;
------------------------------------------
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 20 1 1 5 1 0
connection m_normal_1;
select next value for s_t;
next value for s_t
11
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
connection master;
connection slave;
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
------------------------------------------
update into invalid sequence
------------------------------------------
connection m_normal_1;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
-update s_t set next_value= 11,start=10, min_value=11;
+update s_t set next_not_cached_value= 11,start_value=10, minimum_value=11;
ERROR HY000: Storage engine SEQUENCE of the table `s_db`.`s_t` doesn't have this option
ALTER SEQUENCE s_t restart with 11 start=10 minvalue=11;
ERROR HY000: Sequence 's_db.s_t' values are conflicting
@@ -549,14 +549,14 @@ next value for s1
4
commit;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
connection slave;
use s_db;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
------------------------------------------
close session binlog.
@@ -577,14 +577,14 @@ next value for s1
8
set session sql_log_bin=on;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
9 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
connection slave;
use s_db;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
connection m_normal_1;
use s_db;
@@ -609,13 +609,13 @@ select next value for s1;
next value for s1
1
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
use s_db;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection m_normal_1;
use s_db;
@@ -788,7 +788,7 @@ select * from t1;
a
1
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1001 1 9223372036854775806 1 1 1000 0 0
select previous value for s1;
previous value for s1
@@ -810,7 +810,7 @@ a (next value for s1)
2 3
do setval(s1,10000,0);
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
10000 1 9223372036854775806 1 1 1000 0 0
connection m_normal_2;
drop table t1;
diff --git a/mysql-test/suite/sql_sequence/gtid.test b/mysql-test/suite/sql_sequence/gtid.test
index 98760119b53..a354062a05c 100644
--- a/mysql-test/suite/sql_sequence/gtid.test
+++ b/mysql-test/suite/sql_sequence/gtid.test
@@ -263,7 +263,7 @@ select * from s_t;
connection m_normal_1;
select next value for s_t;
--error ER_ILLEGAL_HA
-update s_t set next_value= 11;
+update s_t set next_not_cached_value= 11;
alter sequence s_t restart=11;
commit;
@@ -295,7 +295,7 @@ select * from s_t;
connection m_normal_1;
select * from s_t;
--error ER_ILLEGAL_HA
-update s_t set next_value= 11,start=10, min_value=11;
+update s_t set next_not_cached_value= 11,start_value=10, minimum_value=11;
--error ER_SEQUENCE_INVALID_DATA
ALTER SEQUENCE s_t restart with 11 start=10 minvalue=11;
commit;
diff --git a/mysql-test/suite/sql_sequence/mysqldump.result b/mysql-test/suite/sql_sequence/mysqldump.result
index 30f0719f16e..0067709db54 100644
--- a/mysql-test/suite/sql_sequence/mysqldump.result
+++ b/mysql-test/suite/sql_sequence/mysqldump.result
@@ -5,14 +5,14 @@ CREATE SEQUENCE x1 engine=innodb;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `a1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `a1` VALUES (1,1,9223372036854775806,1,1,1000,0,0);
@@ -27,14 +27,14 @@ INSERT INTO `t1` VALUES (1),(2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `x1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `x1` VALUES (1,1,9223372036854775806,1,1,1000,0,0);
diff --git a/mysql-test/suite/sql_sequence/next.result b/mysql-test/suite/sql_sequence/next.result
index b7d3a8ff26d..a10c131e0e1 100644
--- a/mysql-test/suite/sql_sequence/next.result
+++ b/mysql-test/suite/sql_sequence/next.result
@@ -2,80 +2,80 @@ CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 2 cy
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
3 0
select next value for t1;
next value for t1
2
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
3 0
select next value for t1;
next value for t1
3
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
5 0
select next value for t1;
next value for t1
4
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
5 0
select next value for t1;
next value for t1
5
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
7 0
select next value for t1;
next value for t1
6
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
7 0
select next value for t1;
next value for t1
7
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
9 0
select next value for t1;
next value for t1
8
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
9 0
select next value for t1;
next value for t1
9
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
11 0
select next value for t1;
next value for t1
10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
11 0
select next value for t1;
next value for t1
1
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
3 1
select NEXT VALUE for t1,seq from seq_1_to_20;
NEXT VALUE for t1 seq
@@ -104,68 +104,68 @@ CREATE SEQUENCE t1 minvalue 1 maxvalue 10 increment by -1 cache 2 cycle engine=a
select next value for t1;
next value for t1
10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
8 0
select next value for t1;
next value for t1
9
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
8 0
select next value for t1;
next value for t1
8
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
6 0
select next value for t1;
next value for t1
7
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
6 0
select next value for t1;
next value for t1
6
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
4 0
select next value for t1;
next value for t1
5
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
4 0
select next value for t1;
next value for t1
4
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2 0
select next value for t1;
next value for t1
3
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2 0
select next value for t1;
next value for t1
2
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
0 0
select next value for t1;
next value for t1
1
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
0 0
select next value for t1;
next value for t1
10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
8 1
select NEXT VALUE for t1,seq from seq_1_to_20;
NEXT VALUE for t1 seq
@@ -235,7 +235,7 @@ select next value for t1;
next value for t1
1
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 100 1 1 10 0 0
flush tables;
select next value for t1;
@@ -284,58 +284,58 @@ seq previous value for t9 NEXT VALUE for t9 previous value for t9
19 10 1 1
20 1 2 2
select * from t9;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
6 1 10 1 1 5 1 2
drop sequence t9;
CREATE SEQUENCE s1 cache=0;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 0 0 0
select next value for s1;
next value for s1
1
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
2
select next value for s1;
next value for s1
2
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
3
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=1;
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
1
select next value for s1;
next value for s1
1
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
2
select next value for s1;
next value for s1
2
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
3
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=2;
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
1
select next value for s1;
next value for s1
1
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
3
select next value for s1;
next value for s1
2
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
3
DROP SEQUENCE s1;
CREATE SEQUENCE s1;
@@ -353,7 +353,7 @@ next value for s1
4
alter sequence s1 increment -2;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1001 1 9223372036854775806 1 -2 1000 0 0
select next value for s1;
next value for s1
@@ -404,17 +404,17 @@ INCREMENT BY 1 START WITH 3984356 CACHE 20 CYCLE engine=innodb;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984356 1 9999999999 3984356 1 20 1 0
select NEXT VALUE FOR s1;
NEXT VALUE FOR s1
@@ -426,24 +426,24 @@ select NEXT VALUE FOR s1;
NEXT VALUE FOR s1
3984358
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984376 1 9999999999 3984356 1 20 1 0
FLUSH TABLES;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984376 1 9999999999 3984356 1 20 1 0
select NEXT VALUE FOR s1;
NEXT VALUE FOR s1
3984376
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984396 1 9999999999 3984356 1 20 1 0
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, min_value from t1;
+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;
@@ -472,7 +472,7 @@ a b
drop table t1,s1;
CREATE OR REPLACE SEQUENCE s1 MINVALUE 1 MAXVALUE 9999999999 INCREMENT BY 1 START WITH 3984356 nocache CYCLE engine='innodb';
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984356 1 9999999999 3984356 1 0 1 0
select next value for s1;
next value for s1
@@ -496,8 +496,8 @@ create sequence t1;
select next value for t1;
next value for t1
1
-select next value for t1, min_value;
-ERROR 42S22: Unknown column 'min_value' in 'field list'
+select next value for t1, minimum_value;
+ERROR 42S22: Unknown column 'minimum_value' in 'field list'
drop sequence t1;
#
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
diff --git a/mysql-test/suite/sql_sequence/next.test b/mysql-test/suite/sql_sequence/next.test
index cf67b7a2752..271c4a6558a 100644
--- a/mysql-test/suite/sql_sequence/next.test
+++ b/mysql-test/suite/sql_sequence/next.test
@@ -8,27 +8,27 @@
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 2 cycle;
show create table t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select NEXT VALUE for t1,seq from seq_1_to_20;
@@ -36,27 +36,27 @@ drop sequence t1;
CREATE SEQUENCE t1 minvalue 1 maxvalue 10 increment by -1 cache 2 cycle engine=aria;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select NEXT VALUE for t1,seq from seq_1_to_20;
@@ -85,7 +85,7 @@ select next value for s1;
drop sequence s1;
#
-# Test that flush tables jumps to next next_value
+# Test that flush tables jumps to next next_not_cached_value
#
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 100 increment by 1 cache 10;
@@ -116,23 +116,23 @@ drop sequence t9;
CREATE SEQUENCE s1 cache=0;
select * from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=1;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=2;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
DROP SEQUENCE s1;
#
@@ -196,7 +196,7 @@ 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;
-explain select next value for t1, min_value from t1;
+explain select next value for t1, minimum_value from t1;
drop table t1;
#
@@ -244,7 +244,7 @@ drop table t1;
create sequence t1;
select next value for t1;
--error ER_BAD_FIELD_ERROR
-select next value for t1, min_value;
+select next value for t1, minimum_value;
drop sequence t1;
--echo #
diff --git a/mysql-test/suite/sql_sequence/other.result b/mysql-test/suite/sql_sequence/other.result
index ea72e264b34..90e3a0737c6 100644
--- a/mysql-test/suite/sql_sequence/other.result
+++ b/mysql-test/suite/sql_sequence/other.result
@@ -37,16 +37,16 @@ select next value for s1;
next value for s1
1001
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
2001 1 9223372036854775806 1 1 1000 0 0
drop sequence s1;
#
-# ÌNSERT
+# INSERT
#
create sequence s1;
create sequence s2;
-insert into s1 (next_value, min_value) values (100,1000);
-ERROR HY000: Field 'max_value' doesn't have a default value
+insert into s1 (next_not_cached_value, minimum_value) values (100,1000);
+ERROR HY000: Field 'maximum_value' doesn't have a default value
insert into s1 values (next value for s1, 1,9223372036854775806,1,1,1000,0,0);
ERROR HY000: Table 's1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into s1 values (next value for s2, 1,9223372036854775806,1,1,1000,0,0);
@@ -58,17 +58,17 @@ ERROR HY000: Sequence 'test.s1' values are conflicting
insert into s1 values(0,9223372036854775806,1,1,1,1000,0,0);
ERROR HY000: Sequence 'test.s1' values are conflicting
select * from s1;
-next_value min_value max_value start increment cache cycle round
+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
insert into s1 values(1000,1,9223372036854775806,1,1,1000,0,0);
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1000 1 9223372036854775806 1 1 1000 0 0
select next value for s1;
next value for s1
1000
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
2000 1 9223372036854775806 1 1 1000 0 0
insert into s2 values(0, 1, 10, 1, 2, 1, 1, 0);
ERROR HY000: Sequence 'test.s2' values are conflicting
@@ -77,9 +77,9 @@ drop sequence s1,s2;
# UPDATE and DELETE
#
create sequence s1;
-update s1 set next_value=100;
+update s1 set next_not_cached_value=100;
ERROR HY000: Storage engine SEQUENCE of the table `test`.`s1` doesn't have this option
-delete from s1 where next_value > 0;
+delete from s1 where next_not_cached_value > 0;
ERROR HY000: Storage engine SEQUENCE of the table `test`.`s1` doesn't have this option
drop sequence s1;
#
@@ -106,7 +106,7 @@ drop view v1;
create sequence s1 engine=innodb;
LOCK TABLES s1 READ;
SELECT * from s1;
-next_value min_value max_value start increment cache cycle round
+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
UNLOCK TABLES;
LOCK TABLES s1 WRITE;
@@ -123,7 +123,7 @@ count(nextval(s1))
2000
commit;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
2001 1 9223372036854775806 1 1 1000 0 0
drop sequence s1;
create sequence s1 cache=1000 engine=innodb;
@@ -138,13 +138,27 @@ select count(nextval(s1)) from seq_1_to_2000;
count(nextval(s1))
2000
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
4001 1 9223372036854775806 1 1 1000 0 0
commit;
disconnect addconroot;
connection default;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
4001 1 9223372036854775806 1 1 1000 0 0
commit;
drop sequence s1;
+#
+# Flush tables with read lock
+#
+create sequence s1;
+select next value for s1;
+next value for s1
+1
+flush tables with read lock;
+create sequence s2;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+select next value for s1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+drop sequence s1;
diff --git a/mysql-test/suite/sql_sequence/other.test b/mysql-test/suite/sql_sequence/other.test
index 0caeb342bc9..d816ec7c108 100644
--- a/mysql-test/suite/sql_sequence/other.test
+++ b/mysql-test/suite/sql_sequence/other.test
@@ -29,13 +29,13 @@ select * from s1;
drop sequence s1;
--echo #
---echo # ÌNSERT
+--echo # INSERT
--echo #
create sequence s1;
create sequence s2;
--error ER_NO_DEFAULT_FOR_FIELD
-insert into s1 (next_value, min_value) values (100,1000);
+insert into s1 (next_not_cached_value, minimum_value) values (100,1000);
--error ER_UPDATE_TABLE_USED
insert into s1 values (next value for s1, 1,9223372036854775806,1,1,1000,0,0);
--error ER_WRONG_INSERT_INTO_SEQUENCE
@@ -61,9 +61,9 @@ drop sequence s1,s2;
create sequence s1;
--error ER_ILLEGAL_HA
-update s1 set next_value=100;
+update s1 set next_not_cached_value=100;
--error ER_ILLEGAL_HA
-delete from s1 where next_value > 0;
+delete from s1 where next_not_cached_value > 0;
drop sequence s1;
--echo #
@@ -117,3 +117,17 @@ connection default;
select * from s1;
commit;
drop sequence s1;
+
+--echo #
+--echo # Flush tables with read lock
+--echo #
+
+create sequence s1;
+select next value for s1;
+flush tables with read lock;
+--error 1223
+create sequence s2;
+--error 1223
+select next value for s1;
+unlock tables;
+drop sequence s1;
diff --git a/mysql-test/suite/sql_sequence/read_only.result b/mysql-test/suite/sql_sequence/read_only.result
index 3f6a95610dd..38edcc0894b 100644
--- a/mysql-test/suite/sql_sequence/read_only.result
+++ b/mysql-test/suite/sql_sequence/read_only.result
@@ -23,3 +23,16 @@ select next value for s1;
ERROR HY000: Table 's1' is read only
select next value for s1;
ERROR HY000: Table 's1' is read only
+select * from s1;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+1 1 9223372036854775806 1 1 2 0 0
+select * from s1;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+1 1 9223372036854775806 1 1 2 0 0
+select next value for s1;
+next value for s1
+1
+select * from s1;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+3 1 9223372036854775806 1 1 2 0 0
+drop sequence s1;
diff --git a/mysql-test/suite/sql_sequence/read_only.test b/mysql-test/suite/sql_sequence/read_only.test
index 04dab2bb525..73103384882 100644
--- a/mysql-test/suite/sql_sequence/read_only.test
+++ b/mysql-test/suite/sql_sequence/read_only.test
@@ -7,12 +7,8 @@
create sequence s1 cache 2 engine=innodb;
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 10
---source include/wait_until_disconnected.inc
---enable_reconnect
---exec echo "restart":--innodb_read_only=1 > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-read-only
+--source include/restart_mysqld.inc
connection default;
show global variables like 'innodb_read_only';
@@ -38,3 +34,11 @@ select next value for s1;
select next value for s1;
--error ER_OPEN_AS_READONLY
select next value for s1;
+
+select * from s1;
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+select * from s1;
+select next value for s1;
+select * from s1;
+drop sequence s1;
diff --git a/mysql-test/suite/sql_sequence/replication.result b/mysql-test/suite/sql_sequence/replication.result
index 12355851f7b..5c7d45614e9 100644
--- a/mysql-test/suite/sql_sequence/replication.result
+++ b/mysql-test/suite/sql_sequence/replication.result
@@ -23,27 +23,27 @@ create sequence s1;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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
connection slave;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `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` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `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
connection master;
drop sequence s1;
@@ -73,38 +73,37 @@ support create sequence
connection master;
create table t_1(id int);
show create sequence t_1;
-ERROR HY000: 's_db.t_1' is not SEQUENCE
+ERROR 42S02: 's_db.t_1' is not a SEQUENCE
drop table t_1;
CREATE SEQUENCE `s2` (
-`currval` bigint(21) NOT NULL COMMENT 'current value',
-`nextval` bigint(21) NOT NULL COMMENT 'next value',
-`minvalue` bigint(21) NOT NULL COMMENT 'min value',
-`maxvalue` bigint(21) NOT NULL COMMENT 'max value',
-`start` bigint(21) NOT NULL COMMENT 'start value',
-`increment` bigint(21) NOT NULL COMMENT 'increment value',
-`cache` bigint(21) NOT NULL COMMENT 'cache size',
-`cycle` bigint(21) NOT NULL COMMENT 'cycle state',
-`round` bigint(21) NOT NULL COMMENT 'already how many round'
+`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=InnoDB sequence=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 '(
-`currval` bigint(21) NOT NULL COMMENT 'current value',
-`nextval` bigint(21) NO' at line 1
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NU' at line 1
CREATE TABLE `s2` (
-`next_value` bigint(21) NOT NULL COMMENT 'next value',
-`min_value` bigint(21) NOT NULL COMMENT 'min value',
-`max_value` bigint(21) NOT NULL COMMENT 'max value',
-`start` bigint(21) NOT NULL COMMENT 'start value',
-`increment` bigint(21) NOT NULL COMMENT 'increment value',
-`cache` bigint(21) NOT NULL COMMENT 'cache size',
-`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
-`round` bigint(21) NOT NULL COMMENT 'already how many round'
+`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=InnoDB sequence=1;
insert into s2 values(1, 1, 10, 1, 2, 1, 1, 0);
commit;
select * for s2;
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 's2' at line 1
select * from s2;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 10 1 2 1 1 0
select NEXT VALUE for s2;
NEXT VALUE for s2
@@ -128,25 +127,25 @@ select NEXT VALUE for s2;
NEXT VALUE for s2
3
select * from s2;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 10 1 2 1 1 1
commit;
connection master;
connection slave;
select * from s2;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 10 1 2 1 1 1
connection master;
drop sequence s2;
CREATE TABLE `s2` (
-`next_value` bigint(21) NOT NULL COMMENT 'next value',
-`min_value` bigint(21) NOT NULL COMMENT 'min value',
-`max_value` bigint(21) NOT NULL COMMENT 'max value',
-`start` bigint(21) NOT NULL COMMENT 'start value',
-`increment` bigint(21) NOT NULL COMMENT 'increment value',
-`cache` bigint(21) NOT NULL COMMENT 'cache size',
-`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
-`round` bigint(21) NOT NULL COMMENT 'already how many round'
+`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 DEFAULT CHARSET=latin1 sequence=1;
show create sequence s2;
Table Create Table
@@ -159,7 +158,7 @@ connection master;
create sequence s2;
create table t2 (id int);
select * from s2;
-next_value min_value max_value start increment cache cycle round
+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
select * from t2;
id
@@ -171,7 +170,7 @@ NEXT VALUE for s2
select NEXT VALUE for t2;
ERROR 42S02: 's_db.t2' is not a SEQUENCE
select * from s2, t2;
-next_value min_value max_value start increment cache cycle round id
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count id
1001 1 9223372036854775806 1 1 1000 0 0 1
select * for s2;
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 's2' at line 1
@@ -191,7 +190,7 @@ show create sequence s2_2;
Table Create Table
s2_2 CREATE SEQUENCE `s2_2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from s2_2;
-next_value min_value max_value start increment cache cycle round
+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
truncate table s2_2;
ERROR HY000: Storage engine SEQUENCE of the table `s_db`.`s2_2` doesn't have this option
@@ -339,7 +338,7 @@ show global variables like 'read_only';
Variable_name Value
read_only OFF
select * from s_db.s1;
-next_value min_value max_value start increment cache cycle round
+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
connection master;
connection slave;
@@ -360,7 +359,7 @@ connection master;
connection slave;
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 20 1 1 5 1 0
connection m_normal_1;
select next value for s_t;
@@ -369,8 +368,8 @@ next value for s_t
connection master;
connection slave;
connection s_normal_3;
-select next_value from s_t;
-next_value
+select next_not_cached_value from s_t;
+next_not_cached_value
6
------------------------------------------
master ALTER SEQUENCE
@@ -381,7 +380,7 @@ next value for s_t
2
alter sequence s_t restart= 11;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 20 1 1 5 1 0
connection master;
connection slave;
@@ -390,7 +389,7 @@ show slave nextval;
------------------------------------------
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 20 1 1 5 1 0
connection m_normal_1;
select next value for s_t;
@@ -400,7 +399,7 @@ connection master;
connection slave;
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
------------------------------------------
update into invalid sequence
@@ -410,17 +409,17 @@ select next value for s_t;
next value for s_t
12
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
alter sequence s_t minvalue=11 maxvalue=9;
ERROR HY000: Sequence 's_db.s_t' values are conflicting
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
alter sequence s_t restart= 12 start=10 minvalue=11 maxvalue=20;
ERROR HY000: Sequence 's_db.s_t' values are conflicting
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
------------------------------------------
delete sequence row
@@ -457,7 +456,7 @@ id
2
2222
select * from s_1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
6 1 9223372036854775806 1 1 5 0 0
connection master;
connection slave;
@@ -505,7 +504,7 @@ id
2
2222
select * from s_1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 9223372036854775806 1 1 5 0 0
select next value for s_1;
next value for s_1
@@ -643,12 +642,12 @@ next value for s1
4
commit;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
------------------------------------------
close session binlog.
@@ -669,23 +668,23 @@ next value for s1
8
set session sql_log_bin=on;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
9 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
connection master;
select next value for s1;
next value for s1
9
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 9223372036854775806 1 1 2 0 0
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 9223372036854775806 1 1 2 0 0
connection master;
drop sequence s1;
@@ -711,7 +710,7 @@ next value for s1
connection master;
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection m_normal_1;
drop sequence s1;
@@ -733,12 +732,12 @@ select next value for s1;
next value for s1
2
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection m_normal_1;
drop sequence s1;
@@ -784,7 +783,7 @@ connection m_normal_1;
create sequence s1 cache 2;
create table t as select * from s1;
select * from t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 2 0 0
drop table t;
create table t as select next value for s1;
@@ -918,7 +917,7 @@ test value boundary
###########################################
connection m_normal_1;
------------------------------------------
-round increment by round
+cycle_count increment by cycle_count
------------------------------------------
create sequence s1 start with 5 minvalue 2 maxvalue 7 cache 1 cycle;
select next value for s1;
@@ -950,39 +949,39 @@ next value for s1
select next value for s1;
ERROR HY000: Sequence 's_db.s1' has run out
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
8 2 7 5 1 10 0 0
drop sequence s1;
create sequence s1 start with 2 minvalue 1 maxvalue 3 increment by 3 nocache cycle;
select next value for s1;
next value for s1
2
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 0
select next value for s1;
next value for s1
1
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 1
select next value for s1;
next value for s1
1
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 2
select next value for s1;
next value for s1
1
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 3
select next value for s1;
next value for s1
1
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 4
drop sequence s1;
create sequence s1 start with 2 minvalue 1 maxvalue 3 increment by 3 cache 2 nocycle;
@@ -996,67 +995,67 @@ drop sequence s1;
beyond ulonglong maxvalue
------------------------------------------
create sequence s1 start with 9223372036854775805 minvalue 9223372036854775804 maxvalue 9223372036854775806 cache 1 cycle;
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 3
drop sequence s1;
create sequence s1 start with 9223372036854775805 minvalue 9223372036854775804 maxvalue 9223372036854775806 cache 10 cycle;
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 3
drop sequence s1;
connection master;
diff --git a/mysql-test/suite/sql_sequence/replication.test b/mysql-test/suite/sql_sequence/replication.test
index c1a28a9b5c4..7bd6f00e2ed 100644
--- a/mysql-test/suite/sql_sequence/replication.test
+++ b/mysql-test/suite/sql_sequence/replication.test
@@ -79,33 +79,32 @@ drop sequence s2;
connection master;
create table t_1(id int);
---error ER_WRONG_OBJECT
+--error ER_NOT_SEQUENCE
show create sequence t_1;
drop table t_1;
--error ER_PARSE_ERROR
CREATE SEQUENCE `s2` (
- `currval` bigint(21) NOT NULL COMMENT 'current value',
- `nextval` bigint(21) NOT NULL COMMENT 'next value',
- `minvalue` bigint(21) NOT NULL COMMENT 'min value',
- `maxvalue` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
- `increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` bigint(21) NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'already how many round'
+ `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=InnoDB sequence=1;
CREATE TABLE `s2` (
- `next_value` bigint(21) NOT NULL COMMENT 'next value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
- `increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'already how many round'
+ `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=InnoDB sequence=1;
insert into s2 values(1, 1, 10, 1, 2, 1, 1, 0);
@@ -131,14 +130,14 @@ connection master;
drop sequence s2;
CREATE TABLE `s2` (
- `next_value` bigint(21) NOT NULL COMMENT 'next value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
- `increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'already how many round'
+ `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 DEFAULT CHARSET=latin1 sequence=1;
show create sequence s2;
@@ -355,7 +354,7 @@ connection master;
--sync_slave_with_master
connection s_normal_3;
-select next_value from s_t;
+select next_not_cached_value from s_t;
--echo ------------------------------------------
--echo master ALTER SEQUENCE
@@ -785,7 +784,7 @@ drop sequence s1;
connection m_normal_1;
--echo ------------------------------------------
---echo round increment by round
+--echo cycle_count increment by cycle_count
--echo ------------------------------------------
create sequence s1 start with 5 minvalue 2 maxvalue 7 cache 1 cycle;
select next value for s1;
@@ -806,15 +805,15 @@ drop sequence s1;
create sequence s1 start with 2 minvalue 1 maxvalue 3 increment by 3 nocache cycle;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
drop sequence s1;
create sequence s1 start with 2 minvalue 1 maxvalue 3 increment by 3 cache 2 nocycle;
@@ -827,29 +826,29 @@ drop sequence s1;
--echo beyond ulonglong maxvalue
--echo ------------------------------------------
create sequence s1 start with 9223372036854775805 minvalue 9223372036854775804 maxvalue 9223372036854775806 cache 1 cycle;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
drop sequence s1;
create sequence s1 start with 9223372036854775805 minvalue 9223372036854775804 maxvalue 9223372036854775806 cache 10 cycle;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
drop sequence s1;
connection master;
diff --git a/mysql-test/suite/sql_sequence/setval.result b/mysql-test/suite/sql_sequence/setval.result
index 8e68a717cbf..b7cda27cf96 100644
--- a/mysql-test/suite/sql_sequence/setval.result
+++ b/mysql-test/suite/sql_sequence/setval.result
@@ -5,26 +5,26 @@ Note 1051 Unknown table 'test.t1'
# Test setval function
#
CREATE SEQUENCE t1 cache 10 engine=myisam;
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1 0
do setval(t1,10);
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
11 0
select next value for t1;
next value for t1
11
do setval(t1,12,1);
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
21 0
select next value for t1;
next value for t1
13
do setval(t1,15,0);
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
21 0
select next value for t1;
next value for t1
@@ -39,15 +39,15 @@ do setval(t1,1000,0);
select next value for t1;
next value for t1
1000
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1010 0
do setval(t1,2000,0);
select next value for t1;
next value for t1
2000
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2010 0
select setval(t1,1000,0);
setval(t1,1000,0)
@@ -61,8 +61,8 @@ NULL
select next value for t1;
next value for t1
2002
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2010 0
select setval(t1,2002,0);
setval(t1,2002,0)
@@ -76,40 +76,40 @@ setval(t1,2010,0)
select next value for t1;
next value for t1
2010
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2020 0
drop sequence t1;
#
# Testing with cycle
#
CREATE SEQUENCE t1 cache=10 maxvalue=100 cycle engine=innodb;
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1 0
select setval(t1,100,0);
setval(t1,100,0)
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
100 0
select next value for t1;
next value for t1
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 0
select setval(t1,100,0);
setval(t1,100,0)
NULL
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 0
select next value for t1;
next value for t1
1
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
11 1
select next value for t1;
next value for t1
@@ -117,8 +117,8 @@ next value for t1
select setval(t1,100,0,1);
setval(t1,100,0,1)
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
100 1
select next value for t1;
next value for t1
@@ -126,8 +126,8 @@ next value for t1
select setval(t1,100,1,2);
setval(t1,100,1,2)
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 2
select next value for t1;
next value for t1
@@ -135,8 +135,8 @@ next value for t1
select setval(t1,100,0,3);
setval(t1,100,0,3)
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
100 3
select next value for t1;
next value for t1
@@ -146,27 +146,27 @@ drop sequence t1;
# Testing extreme values
#
CREATE SEQUENCE t1 cache=10 maxvalue=100 engine=innodb;
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1 0
select setval(t1,200);
setval(t1,200)
200
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 0
select next value for t1;
ERROR HY000: Sequence 'test.t1' has run out
drop sequence t1;
CREATE SEQUENCE t1 cache=10 maxvalue=100 cycle engine=innodb;
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1 0
select setval(t1,200);
setval(t1,200)
200
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 0
select next value for t1;
next value for t1
@@ -176,8 +176,8 @@ CREATE SEQUENCE t1 cache=10 maxvalue=0 increment=-10;
select setval(t1,-10);
setval(t1,-10)
-10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
-20 0
select next value for t1;
next value for t1
@@ -185,8 +185,8 @@ next value for t1
select setval(t1,-15);
setval(t1,-15)
NULL
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
-120 0
select next value for t1;
next value for t1
@@ -214,8 +214,8 @@ CREATE SEQUENCE t1 cache=10 maxvalue=0 increment=-10;
select setval(t1,-10,0);
setval(t1,-10,0)
-10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
-10 0
select next value for t1;
next value for t1
@@ -231,8 +231,8 @@ setval(t1,10,0) setval(t1,15,1) setval(t1,5,1)
select next value for t1;
next value for t1
16
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1016 0
explain extended select setval(t1,100),setval(t1,100,TRUE),setval(t1,100,FALSE,50);
id select_type table type possible_keys key key_len ref rows filtered Extra
diff --git a/mysql-test/suite/sql_sequence/setval.test b/mysql-test/suite/sql_sequence/setval.test
index dbb2620d4e4..8f8059fdcae 100644
--- a/mysql-test/suite/sql_sequence/setval.test
+++ b/mysql-test/suite/sql_sequence/setval.test
@@ -8,35 +8,35 @@ drop table if exists t1;
--echo #
CREATE SEQUENCE t1 cache 10 engine=myisam;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
do setval(t1,10);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
do setval(t1,12,1);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
do setval(t1,15,0);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,16,0);
select next value for t1;
do setval(t1,1000,0);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
do setval(t1,2000,0);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
# Set smaller value
select setval(t1,1000,0);
select next value for t1;
select setval(t1,1000,TRUE);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,2002,0);
select next value for t1;
select setval(t1,2010,0);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
drop sequence t1;
--echo #
@@ -44,24 +44,24 @@ drop sequence t1;
--echo #
CREATE SEQUENCE t1 cache=10 maxvalue=100 cycle engine=innodb;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,100,0);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,100,0);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,100,0,1);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,100,1,2);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,100,0,3);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
drop sequence t1;
@@ -70,26 +70,26 @@ drop sequence t1;
--echo #
CREATE SEQUENCE t1 cache=10 maxvalue=100 engine=innodb;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,200);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
--error ER_SEQUENCE_RUN_OUT
select next value for t1;
drop sequence t1;
CREATE SEQUENCE t1 cache=10 maxvalue=100 cycle engine=innodb;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,200);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
drop sequence t1;
CREATE SEQUENCE t1 cache=10 maxvalue=0 increment=-10;
select setval(t1,-10);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,-15);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,-500,FALSE);
select next value for t1;
@@ -101,7 +101,7 @@ drop sequence t1;
CREATE SEQUENCE t1 cache=10 maxvalue=0 increment=-10;
select setval(t1,-10,0);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
drop sequence t1;
@@ -112,7 +112,7 @@ drop sequence t1;
CREATE SEQUENCE t1;
select setval(t1,10,0),setval(t1,15,1),setval(t1,5,1);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
explain extended select setval(t1,100),setval(t1,100,TRUE),setval(t1,100,FALSE,50);
drop sequence t1;
diff --git a/mysql-test/suite/sql_sequence/temporary.result b/mysql-test/suite/sql_sequence/temporary.result
new file mode 100644
index 00000000000..4885b5f8a26
--- /dev/null
+++ b/mysql-test/suite/sql_sequence/temporary.result
@@ -0,0 +1,12 @@
+#
+# Create
+#
+create temporary sequence s1 engine=innodb;
+alter table s1 engine myisam;
+select nextval(s1);
+nextval(s1)
+1
+select * from s1;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+1001 1 9223372036854775806 1 1 1000 0 0
+drop temporary sequence s1;
diff --git a/mysql-test/suite/sql_sequence/temporary.test b/mysql-test/suite/sql_sequence/temporary.test
new file mode 100644
index 00000000000..158f6b4961e
--- /dev/null
+++ b/mysql-test/suite/sql_sequence/temporary.test
@@ -0,0 +1,16 @@
+--source include/have_sequence.inc
+--source include/have_innodb.inc
+
+#
+# Test temporary sequences
+#
+
+--echo #
+--echo # Create
+--echo #
+
+create temporary sequence s1 engine=innodb;
+alter table s1 engine myisam;
+select nextval(s1);
+select * from s1;
+drop temporary sequence s1;