summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2021-10-28 03:37:23 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2021-10-29 05:05:21 +0300
commit1fdac574470a5103dde689c8ce65041487e77f2c (patch)
tree91e62db9bfe286180cd02168907f7d2e44ba0840 /mysql-test
parentfcca0c67b65ba9b869f545b94a4e287a5ec1152d (diff)
downloadmariadb-git-1fdac574470a5103dde689c8ce65041487e77f2c.tar.gz
MDEV-26453 Assertion `0' failed in row_upd_sec_index_entry & corruption
Long UNIQUE HASH index silently creates virtual column index, which should be impossible for base columns featuring AUTO_INCREMENT. Fix: add a relevant check; add new vcol type for a prettier error message.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/long_unique_bugs.result14
-rw-r--r--mysql-test/main/long_unique_bugs.test16
2 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result
index 5d6c0562c8a..738744867c0 100644
--- a/mysql-test/main/long_unique_bugs.result
+++ b/mysql-test/main/long_unique_bugs.result
@@ -288,3 +288,17 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t2 0 a 1 a A NULL NULL NULL YES HASH
t2 0 a 2 b A NULL NULL NULL YES HASH
DROP TABLE t1,t2;
+#
+# MDEV-26453 Assertion `0' failed in row_upd_sec_index_entry & corruption
+#
+CREATE TABLE t (c INT AUTO_INCREMENT KEY, UNIQUE USING HASH(c));
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `c`
+CREATE TABLE t (c INT AUTO_INCREMENT KEY);
+CREATE UNIQUE INDEX i USING HASH ON t (c);
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `c`
+INSERT INTO t VALUES (0);
+SELECT * FROM t;
+c
+1
+DELETE FROM t;
+DROP TABLE t;
diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test
index 34d02b1c8f4..319940690ea 100644
--- a/mysql-test/main/long_unique_bugs.test
+++ b/mysql-test/main/long_unique_bugs.test
@@ -368,3 +368,19 @@ show index from t2;
# Cleanup
DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-26453 Assertion `0' failed in row_upd_sec_index_entry & corruption
+--echo #
+
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+CREATE TABLE t (c INT AUTO_INCREMENT KEY, UNIQUE USING HASH(c));
+
+CREATE TABLE t (c INT AUTO_INCREMENT KEY);
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+CREATE UNIQUE INDEX i USING HASH ON t (c);
+INSERT INTO t VALUES (0);
+SELECT * FROM t;
+DELETE FROM t;
+
+DROP TABLE t;