mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 17:33:44 +01:00
1cae1af6f9
* remove old 5.2+ InnoDB support for virtual columns * enable corresponding parts of the innodb-5.7 sources * copy corresponding test cases from 5.7 * copy detailed Alter_inplace_info::HA_ALTER_FLAGS flags from 5.7 - and more detailed detection of changes in fill_alter_inplace_info() * more "innodb compatibility hooks" in sql_class.cc to - create/destroy/reset a THD (used by background purge threads) - find a prelocked table by name - open a table (from a background purge thread) * different from 5.7: - new service thread "thd_destructor_proxy" to make sure all THDs are destroyed at the correct point in time during the server shutdown - proper opening/closing of tables for vcol evaluations in + FK checks (use already opened prelocked tables) + purge threads (open the table, MDLock it, add it to tdc, close when not needed) - cache open tables in vc_templ - avoid unnecessary allocations, reuse table->record[0] and table->s->default_values - not needed in 5.7, because it overcalculates: + tell the server to calculate vcols for an on-going inline ADD INDEX + calculate vcols for correct error messages * update other engines (mroonga/tokudb) accordingly
52 lines
1.7 KiB
Text
52 lines
1.7 KiB
Text
#
|
|
# Bug#22017616: ASSERTION FAILED: TABLE_SHARE->IS_MISSING_PRIMARY_KEY()
|
|
# == M_PREBUILT->CLUST_IND
|
|
#
|
|
# Ensure that adding indexes with virtual columns are not promoted to
|
|
# primary keys
|
|
#
|
|
# Base line with normal column - should be promoted
|
|
CREATE TABLE t0(a INT NOT NULL) ENGINE=INNODB;
|
|
ALTER TABLE t0 ADD UNIQUE INDEX (a);
|
|
# 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;
|
|
a
|
|
# 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;
|
|
a
|
|
# 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;
|
|
a
|
|
# 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;
|
|
a b
|
|
# Query I_S to verify that 'a' is promoted to pk only when it
|
|
# 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/%';
|
|
TABLE_NAME INDEX_NAME IS_PRIMARY_KEY FIELD_NAME FIELD_POS
|
|
test/t0 a yes a 0
|
|
test/t1 a no a 0
|
|
test/t2 no_pk no a 0
|
|
test/t3 a no a 0
|
|
test/t4 b no b 0
|
|
DROP TABLE t0;
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
DROP TABLE t3;
|
|
DROP TABLE t4;
|