1SET @saved_innodb_compressed_columns_zip_level = @@global.innodb_compressed_columns_zip_level;
2CREATE COMPRESSION_DICTIONARY numbers('one' 'two' 'three');
3SET GLOBAL innodb_compressed_columns_zip_level = 0;
4SET GLOBAL innodb_compressed_columns_zip_level = DEFAULT;
5CREATE TABLE t1(
6id INT,
7a BLOB,
8g BLOB GENERATED ALWAYS AS (a) COLUMN_FORMAT COMPRESSED WITH COMPRESSION_DICTIONARY numbers
9) ENGINE=InnoDB;
10ERROR HY000: Can not define column 'g' in compressed format
11CREATE TABLE t1(
12id INT,
13a BLOB,
14g BLOB GENERATED ALWAYS AS (a) VIRTUAL COLUMN_FORMAT COMPRESSED WITH COMPRESSION_DICTIONARY numbers
15) ENGINE=InnoDB;
16ERROR HY000: Can not define column 'g' in compressed format
17CREATE TABLE t1(
18id INT,
19a BLOB,
20g BLOB GENERATED ALWAYS AS (a) STORED COLUMN_FORMAT COMPRESSED WITH COMPRESSION_DICTIONARY numbers
21) ENGINE=InnoDB;
22SET @long_value = REPEAT('a', 1024);
23INSERT INTO t1 VALUES (1, @long_value, DEFAULT);
24include/assert.inc [the initial value must not be corrupted]
25ALTER TABLE t1 MODIFY g BLOB GENERATED ALWAYS AS (a) STORED COLUMN_FORMAT DEFAULT, ALGORITHM = INPLACE;
26ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY.
27ALTER TABLE t1 MODIFY g BLOB GENERATED ALWAYS AS (a) VIRTUAL;
28ERROR HY000: 'Changing the STORED status' is not supported for generated columns.
29ALTER TABLE t1 MODIFY g BLOB GENERATED ALWAYS AS (a) STORED COLUMN_FORMAT DEFAULT;
30include/assert.inc [the value after removing COMPRESSED attribute must not be corrupted]
31ALTER TABLE t1 MODIFY g BLOB GENERATED ALWAYS AS (a) STORED COLUMN_FORMAT COMPRESSED;
32include/assert.inc [the value after adding COMPRESSED attribute back must not be corrupted]
33ALTER TABLE t1 ADD another_g BLOB GENERATED ALWAYS AS (a) VIRTUAL COLUMN_FORMAT COMPRESSED;
34ERROR HY000: Can not define column 'another_g' in compressed format
35ALTER TABLE t1 ADD another_g BLOB GENERATED ALWAYS AS (a) VIRTUAL;
36ALTER TABLE t1 MODIFY another_g BLOB GENERATED ALWAYS AS (a) VIRTUAL COLUMN_FORMAT COMPRESSED;
37ERROR HY000: Can not define column 'another_g' in compressed format
38ALTER TABLE t1 MODIFY another_g BLOB GENERATED ALWAYS AS (a) STORED COLUMN_FORMAT COMPRESSED;
39ERROR HY000: 'Changing the STORED status' is not supported for generated columns.
40ALTER TABLE t1 DROP another_g;
41SET @long_value = REPEAT('z', 1024);
42UPDATE t1 SET a = @long_value WHERE id = 1;
43include/assert.inc [the value after updating existing record must not be corrupted]
44DELETE FROM t1 WHERE id = 1;
45include/assert.inc [the table must be empty after removing existing record]
46DROP TABLE t1;
47SET GLOBAL innodb_compressed_columns_zip_level = @saved_innodb_compressed_columns_zip_level;
48CREATE TABLE t1(
49f1 INT PRIMARY KEY,
50f2 BLOB COLUMN_FORMAT COMPRESSED,
51f3 BLOB GENERATED ALWAYS AS (f2) VIRTUAL,
52INDEX(f3(200))
53) ROW_FORMAT=COMPRESSED, ENGINE=InnoDB;
54INSERT INTO t1 (f1, f2) VALUES (1, REPEAT('a', 96));
55ALTER TABLE t1 ROW_FORMAT=COMPACT;
56DELETE FROM t1 WHERE f1 = 1;
57DROP TABLE t1;
58CREATE TABLE t (
59a BLOB COLUMN_FORMAT COMPRESSED WITH COMPRESSION_DICTIONARY numbers,
60c BLOB GENERATED ALWAYS AS (a) VIRTUAL,
61INDEX(c(100))
62) ENGINE=InnoDB;
63INSERT INTO t VALUES (REPEAT('a', 16000), DEFAULT);
64SET GLOBAL innodb_purge_stop_now = 1;
65SET GLOBAL debug="+d,ib_purge_virtual_index_callback";
66UPDATE t SET a = REPEAT('m', 16000) WHERE a LIKE "aaa%";
67SET GLOBAL innodb_purge_run_now = 1;
68SET GLOBAL innodb_purge_stop_now = 1;
69SET GLOBAL debug="-d,ib_purge_virtual_index_callback";
70SET GLOBAL innodb_purge_run_now = 1;
71DROP TABLE t;
72SET GLOBAL innodb_purge_stop_now = 1;
73CREATE TABLE t1(
74id INT not null,
75a BLOB NOT NULL COLUMN_FORMAT COMPRESSED WITH COMPRESSION_DICTIONARY numbers,
76vchar CHAR(2) AS (SUBSTR(a, 2, 2)) VIRTUAL,
77INDEX(vchar)
78) ENGINE=InnoDB;
79INSERT INTO t1 VALUES(1, REPEAT('a',8000), DEFAULT);
80UPDATE t1 SET id = 5 where id = 1;
81DELETE FROM t1 WHERE id = 5;
82SET GLOBAL innodb_purge_run_now = 1;
83SET GLOBAL innodb_fast_shutdown = 0;
84# restart
85SET GLOBAL innodb_purge_stop_now = 1;
86DROP TABLE t1;
87SET GLOBAL innodb_purge_run_now = 1;
88DROP COMPRESSION_DICTIONARY numbers;
89