Fixed sequences based on comments from Peter Gulutzan and Andrii Nikitin
- Changed names of SEQUENCE table columns to be more close to ANSI - Fixed error message for SHOW SEQUENCE non_existing_sequence - Allow syntax CACHE +1 - Fixed ALTER TABLE for TEMPORARY sequences.
This commit is contained in:
parent
3356e42d01
commit
36ae8846ca
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 of type '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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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 #
|
||||
|
@ -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,13 @@ 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;
|
||||
|
@ -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;
|
||||
|
@ -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 of type '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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
12
mysql-test/suite/sql_sequence/temporary.result
Normal file
12
mysql-test/suite/sql_sequence/temporary.result
Normal file
@ -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;
|
16
mysql-test/suite/sql_sequence/temporary.test
Normal file
16
mysql-test/suite/sql_sequence/temporary.test
Normal file
@ -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;
|
@ -198,6 +198,18 @@ int ha_sequence::write_row(uchar *buf)
|
||||
/* This calls is from ha_open() as part of create table */
|
||||
DBUG_RETURN(file->write_row(buf));
|
||||
}
|
||||
if (unlikely(sequence->initialized == SEQUENCE::SEQ_IN_ALTER))
|
||||
{
|
||||
int error= 0;
|
||||
/* This is called from alter table */
|
||||
tmp_seq.read_fields(table);
|
||||
if (tmp_seq.check_and_adjust(0))
|
||||
DBUG_RETURN(HA_ERR_SEQUENCE_INVALID_DATA);
|
||||
sequence->copy(&tmp_seq);
|
||||
if (!(error= file->write_row(buf)))
|
||||
sequence->initialized= SEQUENCE::SEQ_READY_TO_USE;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
if (unlikely(sequence->initialized != SEQUENCE::SEQ_READY_TO_USE))
|
||||
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
|
||||
|
||||
@ -280,7 +292,7 @@ int ha_sequence::extra(enum ha_extra_function operation)
|
||||
if (operation == HA_EXTRA_PREPARE_FOR_ALTER_TABLE)
|
||||
{
|
||||
/* In case of ALTER TABLE allow ::write_row() to copy rows */
|
||||
sequence->initialized= SEQUENCE::SEQ_IN_PREPARE;
|
||||
sequence->initialized= SEQUENCE::SEQ_IN_ALTER;
|
||||
}
|
||||
return file->extra(operation);
|
||||
}
|
||||
|
@ -47,18 +47,19 @@ struct Field_definition
|
||||
|
||||
static Field_definition sequence_structure[]=
|
||||
{
|
||||
{"next_value", 21, &type_handler_longlong, {STRING_WITH_LEN("next not cached value")},
|
||||
FL},
|
||||
{"min_value", 21, &type_handler_longlong, {STRING_WITH_LEN("min value")}, FL},
|
||||
{"max_value", 21, &type_handler_longlong, {STRING_WITH_LEN("max value")}, FL},
|
||||
{"start", 21, &type_handler_longlong, {STRING_WITH_LEN("start value")}, FL},
|
||||
{"next_not_cached_value", 21, &type_handler_longlong,
|
||||
{STRING_WITH_LEN("")}, FL},
|
||||
{"minimum_value", 21, &type_handler_longlong, STRING_WITH_LEN(""), FL},
|
||||
{"maximum_value", 21, &type_handler_longlong, STRING_WITH_LEN(""), FL},
|
||||
{"start_value", 21, &type_handler_longlong, {STRING_WITH_LEN("start value when sequences is created or value if RESTART is used")}, FL},
|
||||
{"increment", 21, &type_handler_longlong,
|
||||
{C_STRING_WITH_LEN("increment value")}, FL},
|
||||
{"cache", 21, &type_handler_longlong, {STRING_WITH_LEN("cache size")}, FL},
|
||||
{"cycle", 1, &type_handler_tiny, {STRING_WITH_LEN("cycle state")},
|
||||
{"cache_size", 21, &type_handler_longlong, STRING_WITH_LEN(""),
|
||||
FL | UNSIGNED_FLAG},
|
||||
{"cycle_option", 1, &type_handler_tiny, {STRING_WITH_LEN("0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed")},
|
||||
FL | UNSIGNED_FLAG },
|
||||
{"round", 21, &type_handler_longlong,
|
||||
{STRING_WITH_LEN("How many cycles has been done")}, FL},
|
||||
{"cycle_count", 21, &type_handler_longlong,
|
||||
{STRING_WITH_LEN("How many cycles have been done")}, FL},
|
||||
{NULL, 0, &type_handler_longlong, {STRING_WITH_LEN("")}, 0}
|
||||
};
|
||||
|
||||
@ -458,9 +459,12 @@ int SEQUENCE::read_initial_values(TABLE *table_arg)
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Read data from sequence table and update values
|
||||
Done when table is opened
|
||||
Do the actiual reading of data from sequence table and
|
||||
update values in the sequence object.
|
||||
|
||||
Called once from when table is opened
|
||||
*/
|
||||
|
||||
int SEQUENCE::read_stored_values()
|
||||
|
@ -88,7 +88,8 @@ protected:
|
||||
class SEQUENCE :public sequence_definition
|
||||
{
|
||||
public:
|
||||
enum seq_init { SEQ_UNINTIALIZED, SEQ_IN_PREPARE, SEQ_READY_TO_USE };
|
||||
enum seq_init { SEQ_UNINTIALIZED, SEQ_IN_PREPARE, SEQ_IN_ALTER,
|
||||
SEQ_READY_TO_USE };
|
||||
SEQUENCE();
|
||||
~SEQUENCE();
|
||||
int read_initial_values(TABLE *table);
|
||||
@ -101,6 +102,7 @@ public:
|
||||
{
|
||||
sequence_definition::operator= (*seq);
|
||||
adjust_values(reserved_until);
|
||||
all_values_used= 0;
|
||||
}
|
||||
longlong next_value(TABLE *table, bool second_round, int *error);
|
||||
bool set_value(TABLE *table, longlong next_value, ulonglong round_arg,
|
||||
|
@ -1181,8 +1181,8 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list,
|
||||
else if (thd->lex->table_type == TABLE_TYPE_SEQUENCE &&
|
||||
table_list->table->s->table_type != TABLE_TYPE_SEQUENCE)
|
||||
{
|
||||
my_error(ER_WRONG_OBJECT, MYF(0),
|
||||
table_list->db, table_list->table_name, "SEQUENCE");
|
||||
my_error(ER_NOT_SEQUENCE, MYF(0),
|
||||
table_list->db, table_list->table_name);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -4372,7 +4372,8 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
|
||||
*/
|
||||
if (!is_show_fields_or_keys && result &&
|
||||
(thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE ||
|
||||
thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT))
|
||||
thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT ||
|
||||
thd->get_stmt_da()->sql_errno() == ER_NOT_SEQUENCE))
|
||||
{
|
||||
/*
|
||||
Hide error for a non-existing table.
|
||||
@ -4699,7 +4700,8 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table,
|
||||
if (!share)
|
||||
{
|
||||
if (thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE ||
|
||||
thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT)
|
||||
thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT ||
|
||||
thd->get_stmt_da()->sql_errno() == ER_NOT_SEQUENCE)
|
||||
{
|
||||
res= 0;
|
||||
}
|
||||
|
@ -11969,17 +11969,22 @@ delete_limit_clause:
|
||||
| LIMIT limit_option ROWS_SYM EXAMINED_SYM { thd->parse_error(); MYSQL_YYABORT; }
|
||||
;
|
||||
|
||||
opt_plus:
|
||||
/* empty */
|
||||
| '+'
|
||||
;
|
||||
|
||||
int_num:
|
||||
NUM { int error; $$= (int) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
opt_plus NUM { int error; $$= (int) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| '-' NUM { int error; $$= -(int) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
|
||||
ulong_num:
|
||||
NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
opt_plus NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| HEX_NUM { $$= (ulong) strtol($1.str, (char**) 0, 16); }
|
||||
| LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| FLOAT_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| opt_plus LONG_NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| opt_plus ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| opt_plus DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| opt_plus FLOAT_NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
;
|
||||
|
||||
real_ulong_num:
|
||||
@ -11991,18 +11996,18 @@ real_ulong_num:
|
||||
;
|
||||
|
||||
longlong_num:
|
||||
NUM { int error; $$= (longlong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
opt_plus NUM { int error; $$= (longlong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| LONG_NUM { int error; $$= (longlong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| '-' NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| '-' LONG_NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
|
||||
|
||||
ulonglong_num:
|
||||
NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| DECIMAL_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
| FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
|
||||
opt_plus NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| opt_plus ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| opt_plus LONG_NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| opt_plus DECIMAL_NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
| opt_plus FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); }
|
||||
;
|
||||
|
||||
real_ulonglong_num:
|
||||
|
Loading…
x
Reference in New Issue
Block a user