Commit fdd00665 authored by Alexander Barkov's avatar Alexander Barkov

Revert "Part3: MDEV-18156 Assertion `0' failed or `btr_validate_index(index,...

Revert "Part3: MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH"

This reverts commit 5a9e2b77 in 10.5,
so it produces an error on "bad" generated columns.

Note, 10.2, 10.3, 10.4 produce only warnings, for backward compatibility.
parent 967c14c0
...@@ -52,66 +52,40 @@ Warnings: ...@@ -52,66 +52,40 @@ Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
Warnings: ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t2;
FLUSH TABLES; FLUSH TABLES;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
Warnings: ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` char(5) DEFAULT NULL, `a` char(5) DEFAULT NULL,
`v` varchar(5) GENERATED ALWAYS AS (`a`) STORED `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ADD b INT DEFAULT a;
Warnings: Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` ALTER TABLE t1 ADD b INT DEFAULT a;
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` char(5) DEFAULT NULL, `a` char(5) DEFAULT NULL,
`v` varchar(5) GENERATED ALWAYS AS (`a`) STORED, `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED
`b` int(11) DEFAULT `a`
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
SELECT * FROM t1; SELECT * FROM t1;
a v b a v
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
FLUSH TABLES; FLUSH TABLES;
ALTER TABLE t1 ADD c INT DEFAULT a; ALTER TABLE t1 ADD c INT DEFAULT a;
Warnings: ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
SELECT * FROM t1; SELECT * FROM t1;
a v b c a v
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t1; DROP TABLE t1;
# #
# Fixing a Maria-10.2.26 table with a stored VARCHAR column # Fixing a Maria-10.2.26 table with a stored VARCHAR column
...@@ -203,18 +177,10 @@ Warnings: ...@@ -203,18 +177,10 @@ Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
Warnings: ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t2;
FLUSH TABLES; FLUSH TABLES;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
Warnings: ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -222,33 +188,19 @@ t1 CREATE TABLE `t1` ( ...@@ -222,33 +188,19 @@ t1 CREATE TABLE `t1` (
`v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL,
KEY `v` (`v`) KEY `v` (`v`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ADD b INT DEFAULT a;
Warnings: Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` ALTER TABLE t1 ADD b INT DEFAULT a;
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
FLUSH TABLES; FLUSH TABLES;
ALTER TABLE t1 ADD c INT DEFAULT a; ALTER TABLE t1 ADD c INT DEFAULT a;
Warnings: ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
SELECT * FROM t1; SELECT * FROM t1;
a v b c a v
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
Warnings:
Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
DROP TABLE t1; DROP TABLE t1;
# #
# Fixing a Maria-10.2.26 table with a virtual VARCHAR column # Fixing a Maria-10.2.26 table with a virtual VARCHAR column
......
...@@ -21,25 +21,21 @@ DROP TABLE t1; ...@@ -21,25 +21,21 @@ DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v));
DROP TABLE t1; DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v)); CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v BIT(64) AS (a) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v BIT(64) AS (a) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(v(100))); CREATE TABLE t1 (a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(v(100)));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM resolving dependency --echo # PAD_CHAR_TO_FULL_LENGTH + TRIM resolving dependency
...@@ -79,61 +75,52 @@ DROP TABLE t1; ...@@ -79,61 +75,52 @@ DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM not resolving dependency --echo # PAD_CHAR_TO_FULL_LENGTH + TRIM not resolving dependency
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v(100))); CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v(100)));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING '' FROM a)) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING '' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH '' FROM a)) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH '' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING 'x' FROM a)) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING 'x' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH 'x' FROM a)) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH 'x' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
# more than one space # more than one space
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a CHAR(5), a CHAR(5),
v VARCHAR(5) AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v)); v VARCHAR(5) AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
# more than one space # more than one space
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a CHAR(5), a CHAR(5),
v VARCHAR(5) AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v)); v VARCHAR(5) AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + TRIM(... non_constant FROM a) --echo # PAD_CHAR_TO_FULL_LENGTH + TRIM(... non_constant FROM a)
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a CHAR(5), a CHAR(5),
b CHAR(5), b CHAR(5),
v TEXT AS (TRIM(TRAILING b FROM a)) VIRTUAL, KEY(v(100))); v TEXT AS (TRIM(TRAILING b FROM a)) VIRTUAL, KEY(v(100)));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + RPAD resolving dependency --echo # PAD_CHAR_TO_FULL_LENGTH + RPAD resolving dependency
...@@ -157,12 +144,11 @@ DROP TABLE t1; ...@@ -157,12 +144,11 @@ DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + RPAD not resolving dependency --echo # PAD_CHAR_TO_FULL_LENGTH + RPAD not resolving dependency
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,4,' ')) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,4,' ')) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a CHAR(5), a CHAR(5),
b CHAR(5), b CHAR(5),
...@@ -170,7 +156,6 @@ CREATE TABLE t1 ( ...@@ -170,7 +156,6 @@ CREATE TABLE t1 (
KEY(v) KEY(v)
); );
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + comparison --echo # PAD_CHAR_TO_FULL_LENGTH + comparison
...@@ -179,13 +164,12 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a='a') VIRTUAL, KEY(v)); ...@@ -179,13 +164,12 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a='a') VIRTUAL, KEY(v));
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a CHAR(5) CHARACTER SET latin1 COLLATE latin1_nopad_bin, a CHAR(5) CHARACTER SET latin1 COLLATE latin1_nopad_bin,
v INT AS (a='a') VIRTUAL, KEY(v) v INT AS (a='a') VIRTUAL, KEY(v)
); );
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + LIKE --echo # PAD_CHAR_TO_FULL_LENGTH + LIKE
...@@ -198,25 +182,23 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE NULL) VIRTUAL, KEY(v)); ...@@ -198,25 +182,23 @@ CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE NULL) VIRTUAL, KEY(v));
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a') VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a') VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
--echo # PAD_CHAR_TO_FULL_LENGTH + LENGTH(char_column) = hard dependency --echo # PAD_CHAR_TO_FULL_LENGTH + LENGTH(char_column) = hard dependency
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v INT AS (LENGTH(a)) VIRTUAL, KEY(v)); CREATE TABLE t1 (a CHAR(5), v INT AS (LENGTH(a)) VIRTUAL, KEY(v));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
--echo # --echo #
--echo # Testing NO_UNSIGNED_SUBTRACTION --echo # Testing NO_UNSIGNED_SUBTRACTION
--echo # --echo #
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT UNSIGNED, a INT UNSIGNED,
b INT UNSIGNED, b INT UNSIGNED,
...@@ -224,9 +206,8 @@ CREATE TABLE t1 ( ...@@ -224,9 +206,8 @@ CREATE TABLE t1 (
KEY (c) KEY (c)
); );
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT UNSIGNED, a INT UNSIGNED,
b INT UNSIGNED, b INT UNSIGNED,
...@@ -234,9 +215,8 @@ CREATE TABLE t1 ( ...@@ -234,9 +215,8 @@ CREATE TABLE t1 (
KEY (c) KEY (c)
); );
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT UNSIGNED, a INT UNSIGNED,
b INT UNSIGNED, b INT UNSIGNED,
...@@ -244,7 +224,6 @@ CREATE TABLE t1 ( ...@@ -244,7 +224,6 @@ CREATE TABLE t1 (
KEY (c) KEY (c)
); );
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT UNSIGNED, a INT UNSIGNED,
...@@ -271,7 +250,7 @@ DROP TABLE t1; ...@@ -271,7 +250,7 @@ DROP TABLE t1;
--echo # Comnination: PAD_CHAR_TO_FULL_LENGTH + NO_UNSIGNED_SUBTRACTION --echo # Comnination: PAD_CHAR_TO_FULL_LENGTH + NO_UNSIGNED_SUBTRACTION
--echo # --echo #
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT UNSIGNED, a INT UNSIGNED,
b INT UNSIGNED, b INT UNSIGNED,
...@@ -280,14 +259,13 @@ CREATE TABLE t1 ( ...@@ -280,14 +259,13 @@ CREATE TABLE t1 (
KEY (v) KEY (v)
); );
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
# The below solves the dependency on NO_UNSIGNED_SUBTRACTION # The below solves the dependency on NO_UNSIGNED_SUBTRACTION
# but does not solve the dependency on PAD_CHAR_TO_FULL_LENGTH, # but does not solve the dependency on PAD_CHAR_TO_FULL_LENGTH,
# because the 'length' argument to RPAD() is not a constant. # because the 'length' argument to RPAD() is not a constant.
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT UNSIGNED, a INT UNSIGNED,
b INT UNSIGNED, b INT UNSIGNED,
...@@ -296,7 +274,6 @@ CREATE TABLE t1 ( ...@@ -296,7 +274,6 @@ CREATE TABLE t1 (
KEY (v) KEY (v)
); );
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
...@@ -314,12 +291,10 @@ CREATE TABLE t1 ( ...@@ -314,12 +291,10 @@ CREATE TABLE t1 (
c CHAR(5), c CHAR(5),
v VARCHAR(5) GENERATED ALWAYS AS (c) VIRTUAL v VARCHAR(5) GENERATED ALWAYS AS (c) VIRTUAL
); );
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD KEY(v); ALTER TABLE t1 ADD KEY(v);
SHOW WARNINGS; SHOW WARNINGS;
ALTER TABLE t1 DROP KEY v; --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE INDEX v ON t1 (v); CREATE INDEX v ON t1 (v);
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1; DROP TABLE t1;
...@@ -327,18 +302,16 @@ DROP TABLE t1; ...@@ -327,18 +302,16 @@ DROP TABLE t1;
--echo # A virtual column on the second position in an index - cannot depend on sql_mode --echo # A virtual column on the second position in an index - cannot depend on sql_mode
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (id int, a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(id, v(100))); CREATE TABLE t1 (id int, a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(id, v(100)));
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
--echo # A persisten virtual column cannot depend on sql_mode --echo # A persisten virtual column cannot depend on sql_mode
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT);
SHOW WARNINGS; SHOW WARNINGS;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT); CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT);
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
......
...@@ -25,21 +25,19 @@ SELECT * FROM t1; ...@@ -25,21 +25,19 @@ SELECT * FROM t1;
FLUSH TABLES; FLUSH TABLES;
SELECT * FROM t1; SELECT * FROM t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
DROP TABLE t2;
FLUSH TABLES; FLUSH TABLES;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
DROP TABLE t2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD b INT DEFAULT a; ALTER TABLE t1 ADD b INT DEFAULT a;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
FLUSH TABLES; FLUSH TABLES;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD c INT DEFAULT a; ALTER TABLE t1 ADD c INT DEFAULT a;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -92,20 +90,18 @@ SELECT * FROM t1; ...@@ -92,20 +90,18 @@ SELECT * FROM t1;
FLUSH TABLES; FLUSH TABLES;
SELECT * FROM t1; SELECT * FROM t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
DROP TABLE t2;
FLUSH TABLES; FLUSH TABLES;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
DROP TABLE t2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD b INT DEFAULT a; ALTER TABLE t1 ADD b INT DEFAULT a;
FLUSH TABLES; FLUSH TABLES;
#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
ALTER TABLE t1 ADD c INT DEFAULT a; ALTER TABLE t1 ADD c INT DEFAULT a;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -3866,7 +3866,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, ...@@ -3866,7 +3866,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
outparam->check_constraints= check_constraint_ptr; outparam->check_constraints= check_constraint_ptr;
vcol_init_mode mode= VCOL_INIT_DEPENDENCY_FAILURE_IS_WARNING; vcol_init_mode mode= VCOL_INIT_DEPENDENCY_FAILURE_IS_WARNING;
#if MYSQL_VERSION_ID > 100500
switch (thd->lex->sql_command) switch (thd->lex->sql_command)
{ {
case SQLCOM_CREATE_TABLE: case SQLCOM_CREATE_TABLE:
...@@ -3881,7 +3880,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, ...@@ -3881,7 +3880,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
default: default:
break; break;
} }
#endif
if (parse_vcol_defs(thd, &outparam->mem_root, outparam, if (parse_vcol_defs(thd, &outparam->mem_root, outparam,
&error_reported, mode)) &error_reported, mode))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment