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
49 lines
1.3 KiB
Text
49 lines
1.3 KiB
Text
CREATE DATABASE dump_generated;
|
|
USE dump_generated;
|
|
CREATE TABLE t1 (pk INTEGER, a INTEGER, b INTEGER, c VARCHAR(16),
|
|
sum INTEGER GENERATED ALWAYS AS (a+b),
|
|
sub VARCHAR(4) GENERATED ALWAYS AS (SUBSTRING(c, 1, 4)),
|
|
key k1(sum),
|
|
key k2(sub)
|
|
) engine=innodb;
|
|
INSERT INTO t1(pk, a, b, c) VALUES (1, 11, 12, 'oneone'), (2, 21, 22, 'twotwo');
|
|
SELECT * FROM t1;
|
|
pk a b c sum sub
|
|
1 11 12 oneone 23 oneo
|
|
2 21 22 twotwo 43 twot
|
|
DELETE FROM t1;
|
|
SELECT * FROM t1;
|
|
pk a b c sum sub
|
|
1 11 12 oneone 23 oneo
|
|
2 21 22 twotwo 43 twot
|
|
DELETE FROM t1;
|
|
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t1;
|
|
SELECT * FROM t1;
|
|
pk a b c sum sub
|
|
1 11 12 oneone 23 oneo
|
|
2 21 22 twotwo 43 twot
|
|
DROP TABLE t1;
|
|
# A table with regular columns after generated
|
|
CREATE TABLE t2 (pk INTEGER, a INTEGER, b INTEGER,
|
|
sum INTEGER GENERATED ALWAYS AS (a+b),
|
|
c VARCHAR(16),
|
|
key k1(sum)
|
|
) engine=innodb;
|
|
INSERT INTO t2(pk, a, b, c) VALUES (1, 11, 12, 'oneone'), (2, 21, 22, 'twotwo');
|
|
SELECT * FROM t2;
|
|
pk a b sum c
|
|
1 11 12 23 oneone
|
|
2 21 22 43 twotwo
|
|
DELETE FROM t2;
|
|
SELECT * FROM t2;
|
|
pk a b sum c
|
|
1 11 12 23 oneone
|
|
2 21 22 43 twotwo
|
|
DELETE FROM t2;
|
|
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t2.txt' INTO TABLE t2;
|
|
SELECT * FROM t2;
|
|
pk a b sum c
|
|
1 11 12 23 oneone
|
|
2 21 22 43 twotwo
|
|
DROP TABLE t2;
|
|
DROP DATABASE dump_generated;
|