Commit 0b9842a3 authored by Rucha Deodhar's avatar Rucha Deodhar

MDEV-13005: Fixing bugs in SEQUENCE, part 3, 2/5

Task 2:
changed the error message and made it more reusable.
parent bb4dd70e
...@@ -29,7 +29,7 @@ select * from t1; ...@@ -29,7 +29,7 @@ select * from t1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 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 3 -100 9223372036854775806 50 1 0 0 0
alter sequence t1 minvalue=100 start=100; alter sequence t1 minvalue=100 start=100;
ERROR HY000: Sequence 'test.t1' values are conflicting ERROR HY000: Sequence 'test.t1' has out of range value for options
alter sequence t1 minvalue=100 start=100 restart=100; alter sequence t1 minvalue=100 start=100 restart=100;
show create sequence t1; show create sequence t1;
Table Create Table Table Create Table
...@@ -200,11 +200,11 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si ...@@ -200,11 +200,11 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si
drop sequence t1; drop sequence t1;
CREATE SEQUENCE t1 engine=myisam; CREATE SEQUENCE t1 engine=myisam;
alter sequence t1 minvalue=100; alter sequence t1 minvalue=100;
ERROR HY000: Sequence 'test.t1' values are conflicting ERROR HY000: Sequence 'test.t1' has out of range value for options
drop sequence t1; drop sequence t1;
CREATE SEQUENCE t1 engine=myisam; CREATE SEQUENCE t1 engine=myisam;
alter sequence t1 minvalue=25 maxvalue=20; alter sequence t1 minvalue=25 maxvalue=20;
ERROR HY000: Sequence 'test.t1' values are conflicting ERROR HY000: Sequence 'test.t1' has out of range value for options
drop sequence t1; drop sequence t1;
create table t1 (a int); create table t1 (a int);
alter sequence t1 minvalue=100; alter sequence t1 minvalue=100;
......
...@@ -53,7 +53,7 @@ next value for s1 ...@@ -53,7 +53,7 @@ next value for s1
drop sequence s1; drop sequence s1;
CREATE SEQUENCE t1; CREATE SEQUENCE t1;
alter sequence t1 minvalue=100; alter sequence t1 minvalue=100;
ERROR HY000: Sequence 'test.t1' values are conflicting ERROR HY000: Sequence 'test.t1' has out of range value for options
alter sequence t1 minvalue=100 start=100 restart=100; alter sequence t1 minvalue=100 start=100 restart=100;
rename table t1 to t2; rename table t1 to t2;
select next value for t2; select next value for t2;
......
...@@ -167,11 +167,11 @@ drop sequence if exists t1; ...@@ -167,11 +167,11 @@ drop sequence if exists t1;
Warnings: Warnings:
Note 4091 Unknown SEQUENCE: 'test.t1' Note 4091 Unknown SEQUENCE: 'test.t1'
create sequence t1 start with 10 maxvalue=9; create sequence t1 start with 10 maxvalue=9;
ERROR HY000: Sequence 'test.t1' values are conflicting ERROR HY000: Sequence 'test.t1' has out of range value for options
create sequence t1 minvalue= 100 maxvalue=10; create sequence t1 minvalue= 100 maxvalue=10;
ERROR HY000: Sequence 'test.t1' values are conflicting ERROR HY000: Sequence 'test.t1' has out of range value for options
create sequence t1 start with 9 minvalue=10; create sequence t1 start with 9 minvalue=10;
ERROR HY000: Sequence 'test.t1' values are conflicting ERROR HY000: Sequence 'test.t1' has out of range value for options
create or replace sequence t1 maxvalue=13, increment by -1; create or replace sequence t1 maxvalue=13, increment by -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 ' increment by -1' at line 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 ' increment by -1' at line 1
create or replace sequence t1 start with= 10 maxvalue=13; create or replace sequence t1 start with= 10 maxvalue=13;
...@@ -183,7 +183,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ...@@ -183,7 +183,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
create or replace sequence t1 start with 10 min_value=1 NO MINVALUE; create or replace sequence t1 start with 10 min_value=1 NO MINVALUE;
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 'NO MINVALUE' at line 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 'NO MINVALUE' at line 1
create sequence t1 start with 10 maxvalue=9223372036854775807; create sequence t1 start with 10 maxvalue=9223372036854775807;
ERROR HY000: Sequence 'test.t1' values are conflicting ERROR HY000: Sequence 'test.t1' has out of range value for options
create sequence t1 start with 10 minvalue=-9223372036854775808; create sequence t1 start with 10 minvalue=-9223372036854775808;
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 '9223372036854775808' at line 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 '9223372036854775808' at line 1
create sequence t1 RESTART WITH 10; create sequence t1 RESTART WITH 10;
...@@ -695,3 +695,6 @@ DROP SEQUENCE s1; ...@@ -695,3 +695,6 @@ DROP SEQUENCE s1;
# Task 1: # Task 1:
SET @x = PREVIOUS VALUE FOR x; SET @x = PREVIOUS VALUE FOR x;
ERROR 42S02: Unknown SEQUENCE: 'x' ERROR 42S02: Unknown SEQUENCE: 'x'
# Task 2:
CREATE SEQUENCE x START WITH 1 INCREMENT BY 123456789012345678;
ERROR HY000: Sequence 'test.x' has out of range value for options
...@@ -525,3 +525,7 @@ DROP SEQUENCE s1; ...@@ -525,3 +525,7 @@ DROP SEQUENCE s1;
--echo # Task 1: --echo # Task 1:
--error ER_UNKNOWN_SEQUENCES --error ER_UNKNOWN_SEQUENCES
SET @x = PREVIOUS VALUE FOR x; SET @x = PREVIOUS VALUE FOR x;
--echo # Task 2:
--error ER_SEQUENCE_INVALID_DATA
CREATE SEQUENCE x START WITH 1 INCREMENT BY 123456789012345678;
...@@ -109,28 +109,28 @@ maxvalue 100000 ...@@ -109,28 +109,28 @@ maxvalue 100000
increment by 1 increment by 1
nocache nocache
nocycle; nocycle;
ERROR HY000: Sequence 's_db.s2' values are conflicting ERROR HY000: Sequence 's_db.s2' has out of range value for options
create sequence s2 start with 1 create sequence s2 start with 1
minvalue 5 minvalue 5
maxvalue 5 maxvalue 5
increment by 1 increment by 1
nocache nocache
nocycle; nocycle;
ERROR HY000: Sequence 's_db.s2' values are conflicting ERROR HY000: Sequence 's_db.s2' has out of range value for options
create sequence s2 start with 1 create sequence s2 start with 1
minvalue 5 minvalue 5
maxvalue 4 maxvalue 4
increment by 1 increment by 1
nocache nocache
nocycle; nocycle;
ERROR HY000: Sequence 's_db.s2' values are conflicting ERROR HY000: Sequence 's_db.s2' has out of range value for options
create sequence s2 start with 1 create sequence s2 start with 1
minvalue 5 minvalue 5
maxvalue 4 maxvalue 4
increment by 0 increment by 0
nocache nocache
nocycle; nocycle;
ERROR HY000: Sequence 's_db.s2' values are conflicting ERROR HY000: Sequence 's_db.s2' has out of range value for options
########################################### ###########################################
global read lock prevent query sequence global read lock prevent query sequence
########################################### ###########################################
...@@ -314,7 +314,7 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si ...@@ -314,7 +314,7 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si
update s_t set next_not_cached_value= 11,start_value=10, minimum_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 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; ALTER SEQUENCE s_t restart with 11 start=10 minvalue=11;
ERROR HY000: Sequence 's_db.s_t' values are conflicting ERROR HY000: Sequence 's_db.s_t' has out of range value for options
commit; commit;
create table t_1(id int); create table t_1(id int);
insert into t_1 value(1111); insert into t_1 value(1111);
......
...@@ -50,9 +50,9 @@ ERROR HY000: Field 'maximum_value' doesn't have a default value ...@@ -50,9 +50,9 @@ 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); 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 ERROR HY000: Table 's1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into s1 values(1000,9223372036854775806,1,1,1,1000,0,0); insert into s1 values(1000,9223372036854775806,1,1,1,1000,0,0);
ERROR HY000: Sequence 'test.s1' values are conflicting ERROR HY000: Sequence 'test.s1' has out of range value for options
insert into s1 values(0,9223372036854775806,1,1,1,1000,0,0); insert into s1 values(0,9223372036854775806,1,1,1,1000,0,0);
ERROR HY000: Sequence 'test.s1' values are conflicting ERROR HY000: Sequence 'test.s1' has out of range value for options
select * from s1; select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 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 1 1 9223372036854775806 1 1 1000 0 0
...@@ -67,7 +67,7 @@ select * from s1; ...@@ -67,7 +67,7 @@ select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 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 2000 1 9223372036854775806 1 1 1000 0 0
insert into s2 values(0, 1, 10, 1, 2, 1, 1, 0); insert into s2 values(0, 1, 10, 1, 2, 1, 1, 0);
ERROR HY000: Sequence 'test.s2' values are conflicting ERROR HY000: Sequence 'test.s2' has out of range value for options
select * from s1; select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 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 2000 1 9223372036854775806 1 1 1000 0 0
......
...@@ -227,28 +227,28 @@ maxvalue 100000 ...@@ -227,28 +227,28 @@ maxvalue 100000
increment by 1 increment by 1
nocache nocache
nocycle; nocycle;
ERROR HY000: Sequence 's_db.s2' values are conflicting ERROR HY000: Sequence 's_db.s2' has out of range value for options
create sequence s2 start with 1 create sequence s2 start with 1
minvalue 5 minvalue 5
maxvalue 5 maxvalue 5
increment by 1 increment by 1
nocache nocache
nocycle; nocycle;
ERROR HY000: Sequence 's_db.s2' values are conflicting ERROR HY000: Sequence 's_db.s2' has out of range value for options
create sequence s2 start with 1 create sequence s2 start with 1
minvalue 5 minvalue 5
maxvalue 4 maxvalue 4
increment by 1 increment by 1
nocache nocache
nocycle; nocycle;
ERROR HY000: Sequence 's_db.s2' values are conflicting ERROR HY000: Sequence 's_db.s2' has out of range value for options
create sequence s2 start with 1 create sequence s2 start with 1
minvalue 5 minvalue 5
maxvalue 4 maxvalue 4
increment by 0 increment by 0
nocache nocache
nocycle; nocycle;
ERROR HY000: Sequence 's_db.s2' values are conflicting ERROR HY000: Sequence 's_db.s2' has out of range value for options
########################################### ###########################################
global read lock prevent query sequence global read lock prevent query sequence
########################################### ###########################################
...@@ -412,12 +412,12 @@ select * from s_t; ...@@ -412,12 +412,12 @@ select * from s_t;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 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 16 1 20 1 1 5 1 0
alter sequence s_t minvalue=11 maxvalue=9; alter sequence s_t minvalue=11 maxvalue=9;
ERROR HY000: Sequence 's_db.s_t' values are conflicting ERROR HY000: Sequence 's_db.s_t' has out of range value for options
select * from s_t; select * from s_t;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 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 16 1 20 1 1 5 1 0
alter sequence s_t restart= 12 start=10 minvalue=11 maxvalue=20; alter sequence s_t restart= 12 start=10 minvalue=11 maxvalue=20;
ERROR HY000: Sequence 's_db.s_t' values are conflicting ERROR HY000: Sequence 's_db.s_t' has out of range value for options
select * from s_t; select * from s_t;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 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 16 1 20 1 1 5 1 0
......
...@@ -7762,7 +7762,7 @@ ER_END_IDENTIFIER_DOES_NOT_MATCH ...@@ -7762,7 +7762,7 @@ ER_END_IDENTIFIER_DOES_NOT_MATCH
ER_SEQUENCE_RUN_OUT ER_SEQUENCE_RUN_OUT
eng "Sequence '%-.64s.%-.64s' has run out" eng "Sequence '%-.64s.%-.64s' has run out"
ER_SEQUENCE_INVALID_DATA ER_SEQUENCE_INVALID_DATA
eng "Sequence '%-.64s.%-.64s' values are conflicting" eng "Sequence '%-.64s.%-.64s' has out of range value for options"
ER_SEQUENCE_INVALID_TABLE_STRUCTURE ER_SEQUENCE_INVALID_TABLE_STRUCTURE
eng "Sequence '%-.64s.%-.64s' table structure is invalid (%s)" eng "Sequence '%-.64s.%-.64s' table structure is invalid (%s)"
ER_SEQUENCE_ACCESS_ERROR ER_SEQUENCE_ACCESS_ERROR
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment