summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/storage_engine/autoinc_vars.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/storage_engine/autoinc_vars.test
parentInitial commit. (diff)
downloadmariadb-upstream.tar.xz
mariadb-upstream.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/storage_engine/autoinc_vars.test')
-rw-r--r--mysql-test/suite/storage_engine/autoinc_vars.test68
1 files changed, 68 insertions, 0 deletions
diff --git a/mysql-test/suite/storage_engine/autoinc_vars.test b/mysql-test/suite/storage_engine/autoinc_vars.test
new file mode 100644
index 00000000..b154fd79
--- /dev/null
+++ b/mysql-test/suite/storage_engine/autoinc_vars.test
@@ -0,0 +1,68 @@
+#
+# auto-increment-offset and auto-increment-increment
+#
+
+--source have_engine.inc
+--source have_default_index.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# auto_increment_offset
+SET auto_increment_offset = 200;
+--let $create_definition = a $int_indexed_col AUTO_INCREMENT, b $char_col, $default_index(a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = AUTO_INCREMENT
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ # If auto_increment_offset is greater than auto_increment_increment,
+ # the offset is ignored
+ INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT a,b FROM t1;
+
+ # auto_increment_increment
+
+ SET auto_increment_increment = 300;
+ # offset should not be ignored anymore
+ INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT a,b FROM t1;
+
+ SET auto_increment_increment = 50;
+ INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT a,b FROM t1;
+ DROP TABLE t1;
+}
+
+# offset is greater than the max value
+
+SET auto_increment_increment = 500;
+SET auto_increment_offset = 300;
+--let $create_definition = a TINYINT $default_col_indexed_opts AUTO_INCREMENT, $default_index(a)
+--source create_table.inc
+if ($mysql_errname)
+{
+ --let $functionality = AUTO_INCREMENT
+ --source unexpected_result.inc
+}
+if (!$mysql_errname)
+{
+ INSERT INTO t1 (a) VALUES (NULL);
+ SELECT LAST_INSERT_ID();
+ --sorted_result
+ SELECT a FROM t1;
+ DROP TABLE t1;
+}
+
+--source cleanup_engine.inc
+