summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sql_sequence/next.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/sql_sequence/next.test')
-rw-r--r--mysql-test/suite/sql_sequence/next.test179
1 files changed, 179 insertions, 0 deletions
diff --git a/mysql-test/suite/sql_sequence/next.test b/mysql-test/suite/sql_sequence/next.test
index a80f9fad561..62caad8e215 100644
--- a/mysql-test/suite/sql_sequence/next.test
+++ b/mysql-test/suite/sql_sequence/next.test
@@ -297,3 +297,182 @@ SELECT SETVAL (v,0);
UNLOCK TABLES;
DROP VIEW v;
+
+--echo #
+--echo # MDEV-28152 Features for sequence
+--echo #
+
+create or replace sequence t1 as tinyint unsigned minvalue 1 maxvalue 2;
+show create sequence t1;
+show create table t1;
+select * from t1;
+select next value for t1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+
+create or replace sequence t1 as tinyint unsigned minvalue 1 maxvalue 2 cycle;
+show create sequence t1;
+show create table t1;
+select * from t1;
+select next value for t1;
+select next value for t1;
+select next value for t1;
+
+--disable_ps_protocol
+create or replace sequence t1 minvalue -23 maxvalue 99999 as tinyint;
+--enable_ps_protocol
+show create sequence t1;
+show create table t1;
+select * from t1;
+select next value for t1;
+select next value for t1;
+select next value for t1;
+
+#test previous value for bigint unsigned
+create or replace sequence t1 as bigint unsigned start with 18446744073709551614;
+select previous value for t1;
+select next value for t1;
+select previous value for t1;
+
+create or replace sequence t1 as tinyint start with 126;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as tinyint unsigned start with 254;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as smallint start with 32766;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as smallint unsigned start with 65534;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as mediumint start with 8388606;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as mediumint unsigned start with 16777214;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as int start with 2147483646;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as int unsigned start with 4294967294;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as bigint start with 9223372036854775806;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as bigint unsigned start with 18446744073709551614;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as tinyint start with -127 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as tinyint unsigned start with 1 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as smallint start with -32767 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as smallint unsigned start with 1 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as mediumint start with -8388607 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as mediumint unsigned start with 1 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as int start with -2147483647 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as int unsigned start with 1 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as bigint start with -9223372036854775807 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+create or replace sequence t1 as bigint unsigned start with 1 increment -1;
+select next value for t1;
+--error ER_SEQUENCE_RUN_OUT
+select next value for t1;
+alter sequence t1 cycle;
+select next value for t1;
+
+drop sequence t1;