summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sql_sequence
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2022-03-28 15:03:09 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2022-03-30 15:12:33 +0530
commitbb4dd70e7c6509ed9bf8c38d44dffb6d2fcca415 (patch)
tree080a655b22143451c37bbcb61af53f9a93b48cb8 /mysql-test/suite/sql_sequence
parentd59b16dd9605d7caecb454fb9efdaa4dfc5770cc (diff)
downloadmariadb-git-bb4dd70e7c6509ed9bf8c38d44dffb6d2fcca415.tar.gz
MDEV-13005: Fixing bugs in SEQUENCE, part 3, 1/5
Task 1: If table is added to list using option TL_OPTION_SEQUENCE (done when we have sequence functions) then then we are dealing with sequence instead of table. So global table list will have sequence set to true. This is used to check and give correct error message about unknown sequence instead of table doesn't exist.
Diffstat (limited to 'mysql-test/suite/sql_sequence')
-rw-r--r--mysql-test/suite/sql_sequence/alter.result5
-rw-r--r--mysql-test/suite/sql_sequence/alter.test3
-rw-r--r--mysql-test/suite/sql_sequence/create.result12
-rw-r--r--mysql-test/suite/sql_sequence/create.test14
-rw-r--r--mysql-test/suite/sql_sequence/next.result2
-rw-r--r--mysql-test/suite/sql_sequence/next.test2
6 files changed, 28 insertions, 10 deletions
diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result
index 612e2201d26..e0acc1c1b23 100644
--- a/mysql-test/suite/sql_sequence/alter.result
+++ b/mysql-test/suite/sql_sequence/alter.result
@@ -211,10 +211,9 @@ alter sequence t1 minvalue=100;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop table t1;
alter sequence if exists t1 minvalue=100;
-Warnings:
-Note 4091 Unknown SEQUENCE: 'test.t1'
+ERROR 42S02: Unknown SEQUENCE: 't1'
alter sequence t1 minvalue=100;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR 42S02: Unknown SEQUENCE: 't1'
create sequence t1;
alter sequence t1;
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 '' at line 1
diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test
index 53f71018337..a5e6245d609 100644
--- a/mysql-test/suite/sql_sequence/alter.test
+++ b/mysql-test/suite/sql_sequence/alter.test
@@ -119,8 +119,9 @@ create table t1 (a int);
alter sequence t1 minvalue=100;
drop table t1;
+--error ER_UNKNOWN_SEQUENCES
alter sequence if exists t1 minvalue=100;
---error ER_NO_SUCH_TABLE
+--error ER_UNKNOWN_SEQUENCES
alter sequence t1 minvalue=100;
create sequence t1;
diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result
index 5a53a66c9a8..65a4697a6ca 100644
--- a/mysql-test/suite/sql_sequence/create.result
+++ b/mysql-test/suite/sql_sequence/create.result
@@ -478,7 +478,7 @@ next value for t1
1
drop temporary table t1;
select previous value for t1;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR 42S02: Unknown SEQUENCE: 't1'
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10;
select next value for t1;
next value for t1
@@ -507,7 +507,7 @@ next value for t1
1
drop temporary table t1;
select previous value for t1;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR 42S02: Unknown SEQUENCE: 't1'
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10 engine=innodb;
select next value for t1;
next value for t1
@@ -687,3 +687,11 @@ set global innodb_force_primary_key=default;
ALTER TABLE s1 ADD PRIMARY KEY (next_not_cached_value);
ERROR HY000: Sequence 'test.s1' table structure is invalid (Sequence tables cannot have any keys)
DROP SEQUENCE s1;
+#
+# Beginning of 10.4 Test
+#
+# MDEV-13005: Fixing bugs in SEQUENCE, part 3
+#
+# Task 1:
+SET @x = PREVIOUS VALUE FOR x;
+ERROR 42S02: Unknown SEQUENCE: 'x'
diff --git a/mysql-test/suite/sql_sequence/create.test b/mysql-test/suite/sql_sequence/create.test
index ac3aae845cd..9d69924ca71 100644
--- a/mysql-test/suite/sql_sequence/create.test
+++ b/mysql-test/suite/sql_sequence/create.test
@@ -382,7 +382,7 @@ drop view v1;
CREATE TEMPORARY SEQUENCE t1;
select next value for t1;
drop temporary table t1;
---error ER_NO_SUCH_TABLE
+--error ER_UNKNOWN_SEQUENCES
select previous value for t1;
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10;
select next value for t1;
@@ -398,7 +398,7 @@ drop sequence t1;
CREATE TEMPORARY SEQUENCE t1 engine=innodb;
select next value for t1;
drop temporary table t1;
---error ER_NO_SUCH_TABLE
+--error ER_UNKNOWN_SEQUENCES
select previous value for t1;
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 10 engine=innodb;
select next value for t1;
@@ -515,3 +515,13 @@ set global innodb_force_primary_key=default;
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
ALTER TABLE s1 ADD PRIMARY KEY (next_not_cached_value);
DROP SEQUENCE s1;
+
+--echo #
+--echo # Beginning of 10.4 Test
+--echo #
+--echo # MDEV-13005: Fixing bugs in SEQUENCE, part 3
+--echo #
+
+--echo # Task 1:
+--error ER_UNKNOWN_SEQUENCES
+SET @x = PREVIOUS VALUE FOR x;
diff --git a/mysql-test/suite/sql_sequence/next.result b/mysql-test/suite/sql_sequence/next.result
index 76991fbe68c..9d55921006b 100644
--- a/mysql-test/suite/sql_sequence/next.result
+++ b/mysql-test/suite/sql_sequence/next.result
@@ -387,7 +387,7 @@ previous value for t1
1
drop sequence t1;
select previous value for t1;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR 42S02: Unknown SEQUENCE: 't1'
CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
select previous value for t1;
previous value for t1
diff --git a/mysql-test/suite/sql_sequence/next.test b/mysql-test/suite/sql_sequence/next.test
index 9f0eebdf774..a80f9fad561 100644
--- a/mysql-test/suite/sql_sequence/next.test
+++ b/mysql-test/suite/sql_sequence/next.test
@@ -166,7 +166,7 @@ select previous value for t1;
flush tables;
select previous value for t1;
drop sequence t1;
---error ER_NO_SUCH_TABLE
+--error ER_UNKNOWN_SEQUENCES
select previous value for t1;
CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
select previous value for t1;