diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:07:14 +0000 |
commit | a175314c3e5827eb193872241446f2f8f5c9d33c (patch) | |
tree | cd3d60ca99ae00829c52a6ca79150a5b6e62528b /mysql-test/suite/gcol/t/main_alter_table.test | |
parent | Initial commit. (diff) | |
download | mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.tar.xz mariadb-10.5-a175314c3e5827eb193872241446f2f8f5c9d33c.zip |
Adding upstream version 1:10.5.12.upstream/1%10.5.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/gcol/t/main_alter_table.test')
-rw-r--r-- | mysql-test/suite/gcol/t/main_alter_table.test | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/suite/gcol/t/main_alter_table.test b/mysql-test/suite/gcol/t/main_alter_table.test new file mode 100644 index 00000000..2ce768a9 --- /dev/null +++ b/mysql-test/suite/gcol/t/main_alter_table.test @@ -0,0 +1,50 @@ +--source include/have_innodb.inc + +--echo # +--echo # Bug#22017616: ASSERTION FAILED: TABLE_SHARE->IS_MISSING_PRIMARY_KEY() +--echo # == M_PREBUILT->CLUST_IND +--echo # +--echo # Ensure that adding indexes with virtual columns are not promoted to +--echo # primary keys +--echo # +--echo # Base line with normal column - should be promoted +CREATE TABLE t0(a INT NOT NULL) ENGINE=INNODB; +ALTER TABLE t0 ADD UNIQUE INDEX (a); + +--echo # Case a: Create table with virtual unique not null column +CREATE TABLE t1(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL UNIQUE) ENGINE=INNODB; +SELECT * FROM t1; + +--echo # Case b: Create table with index on virtual point column +CREATE TABLE t2(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL, UNIQUE INDEX no_pk(a(1))) ENGINE=INNODB; +SELECT * FROM t2; + +--echo # Case c: Add unique index on virtual point column +CREATE TABLE t3(a POINT GENERATED ALWAYS AS (POINT(1,1)) VIRTUAL) +ENGINE=INNODB; +ALTER TABLE t3 ADD UNIQUE INDEX (a(1)); +SELECT * FROM t3; + +--echo # Case d: Add unique index on virtual blob column +CREATE TABLE t4 (a BLOB, b BLOB GENERATED ALWAYS AS (a) VIRTUAL) ENGINE=INNODB; +ALTER TABLE t4 ADD UNIQUE INDEX (b(1)); +SELECT * FROM t4; + +--echo # Query I_S to verify that 'a' is promoted to pk only when it +--echo # isn't virtual +SELECT T.NAME AS TABLE_NAME, I.NAME AS INDEX_NAME, + CASE (I.TYPE & 3) + WHEN 3 THEN "yes" + ELSE "no" END AS IS_PRIMARY_KEY, + F.NAME AS FIELD_NAME, F.POS AS FIELD_POS FROM + INFORMATION_SCHEMA.INNODB_SYS_TABLES AS T JOIN + INFORMATION_SCHEMA.INNODB_SYS_INDEXES AS I JOIN + INFORMATION_SCHEMA.INNODB_SYS_FIELDS AS F + ON I.INDEX_ID = F.INDEX_ID AND I.TABLE_ID = T.TABLE_ID + WHERE T.NAME LIKE 'test/t%'; + +DROP TABLE t0; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; |