1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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:
Monty
2017-06-03 16:08:23 +03:00
parent 3356e42d01
commit 36ae8846ca
25 changed files with 763 additions and 696 deletions

View File

@ -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;