diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-09-11 13:50:28 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-09-11 13:52:33 +0400 |
commit | fdd00665c2b7abba34a579405b9601627a346ae6 (patch) | |
tree | bbb5203ced81dfc86abb2a0d99d088d36da2a69c /mysql-test/suite/vcol | |
parent | 967c14c04e9e14062bd2b8288e054514af3cd322 (diff) | |
download | mariadb-git-fdd00665c2b7abba34a579405b9601627a346ae6.tar.gz |
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 5a9e2b77d40427d99a29a96551a0f31fdf39edac 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.
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r-- | mysql-test/suite/vcol/r/vcol_sql_mode.result | 208 | ||||
-rw-r--r-- | mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result | 94 | ||||
-rw-r--r-- | mysql-test/suite/vcol/t/vcol_sql_mode.test | 81 | ||||
-rw-r--r-- | mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test | 20 |
4 files changed, 112 insertions, 291 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode.result b/mysql-test/suite/vcol/r/vcol_sql_mode.result index 385939fd037..b1f5387507d 100644 --- a/mysql-test/suite/vcol/r/vcol_sql_mode.result +++ b/mysql-test/suite/vcol/r/vcol_sql_mode.result @@ -28,41 +28,29 @@ DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v)); DROP TABLE t1; CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v)); -Warnings: -Warning 1901 Function or expression '`c`' 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 +ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression '`c`' 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; CREATE TABLE t1 (a CHAR(5), v BIT(64) AS (a) VIRTUAL, KEY(v)); -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 +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 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; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) VIRTUAL, KEY(v)); -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 +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 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; CREATE TABLE t1 (a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(v(100))); -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 +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 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; # PAD_CHAR_TO_FULL_LENGTH + TRIM resolving dependency CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -138,94 +126,67 @@ t1 CREATE TABLE `t1` ( DROP TABLE t1; # PAD_CHAR_TO_FULL_LENGTH + TRIM not resolving dependency CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'trim(leading ' ' from `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 +ERROR HY000: Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(leading ' ' from `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; CREATE TABLE t1 (a CHAR(5), v TEXT AS (TRIM(LEADING ' ' FROM a)) VIRTUAL, KEY(v(100))); -Warnings: -Warning 1901 Function or expression 'trim(leading ' ' from `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 +ERROR HY000: Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(leading ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(leading ' ' from `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; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING '' FROM a)) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'trim(trailing '' from `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 +ERROR HY000: Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(trailing '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(trailing '' from `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; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH '' FROM a)) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'trim(both '' from `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 +ERROR HY000: Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(both '' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(both '' from `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; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING 'x' FROM a)) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'trim(trailing 'x' from `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 +ERROR HY000: Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(trailing 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(trailing 'x' from `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; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH 'x' FROM a)) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'trim(both 'x' from `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 +ERROR HY000: Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(both 'x' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(both 'x' from `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; CREATE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (TRIM(TRAILING ' ' FROM a)) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'trim(trailing ' ' from `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 +ERROR HY000: Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(trailing ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(trailing ' ' from `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; CREATE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (TRIM(BOTH ' ' FROM a)) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'trim(both ' ' from `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 +ERROR HY000: Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(both ' ' from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(both ' ' from `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; # PAD_CHAR_TO_FULL_LENGTH + TRIM(... non_constant FROM a) CREATE TABLE t1 ( a CHAR(5), b CHAR(5), v TEXT AS (TRIM(TRAILING b FROM a)) VIRTUAL, KEY(v(100))); -Warnings: -Warning 1901 Function or expression 'trim(trailing `b` from `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 +ERROR HY000: Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'trim(trailing `b` from `a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'trim(trailing `b` from `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; # PAD_CHAR_TO_FULL_LENGTH + RPAD resolving dependency CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,5,' ')) VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -265,28 +226,22 @@ t1 CREATE TABLE `t1` ( DROP TABLE t1; # PAD_CHAR_TO_FULL_LENGTH + RPAD not resolving dependency CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RPAD(a,4,' ')) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'rpad(`a`,4,' ')' 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 +ERROR HY000: Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'rpad(`a`,4,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'rpad(`a`,4,' ')' 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; CREATE TABLE t1 ( a CHAR(5), b CHAR(5), v VARCHAR(5) AS (RPAD(a,NULL,b)) VIRTUAL, KEY(v) ); -Warnings: -Warning 1901 Function or expression 'rpad(`a`,NULL,`b`)' 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 +ERROR HY000: Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'rpad(`a`,NULL,`b`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'rpad(`a`,NULL,`b`)' 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; # PAD_CHAR_TO_FULL_LENGTH + comparison CREATE TABLE t1 (a CHAR(5), v INT AS (a='a') VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -301,14 +256,11 @@ CREATE TABLE t1 ( a CHAR(5) CHARACTER SET latin1 COLLATE latin1_nopad_bin, v INT AS (a='a') VIRTUAL, KEY(v) ); -Warnings: -Warning 1901 Function or expression '`a` = '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 +ERROR HY000: Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a` = 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression '`a` = '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; # PAD_CHAR_TO_FULL_LENGTH + LIKE CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a%') VIRTUAL, KEY(v)); SHOW CREATE TABLE t1; @@ -329,24 +281,18 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v INT AS (a LIKE 'a') VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression '`a` like '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 +ERROR HY000: Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a` like 'a'' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression '`a` like '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; # PAD_CHAR_TO_FULL_LENGTH + LENGTH(char_column) = hard dependency CREATE TABLE t1 (a CHAR(5), v INT AS (LENGTH(a)) VIRTUAL, KEY(v)); -Warnings: -Warning 1901 Function or expression 'octet_length(`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 +ERROR HY000: Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'octet_length(`a`)' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'octet_length(`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; # # Testing NO_UNSIGNED_SUBTRACTION # @@ -356,42 +302,33 @@ b INT UNSIGNED, c INT GENERATED ALWAYS AS (a-b) VIRTUAL, KEY (c) ); -Warnings: -Warning 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c` -Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION +ERROR HY000: Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c` +Error 1901 Function or expression '`a` - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c` Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION -DROP TABLE t1; CREATE TABLE t1 ( a INT UNSIGNED, b INT UNSIGNED, c INT GENERATED ALWAYS AS (CAST(a AS SIGNED)-b) VIRTUAL, KEY (c) ); -Warnings: -Warning 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c` -Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION +ERROR HY000: Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c` +Error 1901 Function or expression 'cast(`a` as signed) - `b`' cannot be used in the GENERATED ALWAYS AS clause of `c` Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION -DROP TABLE t1; CREATE TABLE t1 ( a INT UNSIGNED, b INT UNSIGNED, c INT GENERATED ALWAYS AS (a-CAST(b AS SIGNED)) VIRTUAL, KEY (c) ); -Warnings: -Warning 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c` -Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION +ERROR HY000: Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c` +Error 1901 Function or expression '`a` - cast(`b` as signed)' cannot be used in the GENERATED ALWAYS AS clause of `c` Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION -DROP TABLE t1; CREATE TABLE t1 ( a INT UNSIGNED, b INT UNSIGNED, @@ -432,16 +369,12 @@ c CHAR(5), v VARCHAR(5) GENERATED ALWAYS AS (RPAD(c,a-b,' ')) VIRTUAL, KEY (v) ); -Warnings: -Warning 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v` -Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION -Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH +ERROR HY000: Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'rpad(`c`,`a` - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v` Warning 1105 Expression depends on the @@sql_mode value NO_UNSIGNED_SUBTRACTION Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH -DROP TABLE t1; CREATE TABLE t1 ( a INT UNSIGNED, b INT UNSIGNED, @@ -449,14 +382,11 @@ c CHAR(5), v VARCHAR(5) GENERATED ALWAYS AS (RPAD(c,CAST(a AS DECIMAL(20,1))-b,' ')) VIRTUAL, KEY (v) ); -Warnings: -Warning 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' 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 +ERROR HY000: Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression 'rpad(`c`,cast(`a` as decimal(20,1)) - `b`,' ')' 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; # ALTER TABLE ADD KEY(vcol_depending_on_sql_mode) --> error CREATE TABLE t1 ( a INT UNSIGNED, @@ -465,62 +395,32 @@ c CHAR(5), v VARCHAR(5) GENERATED ALWAYS AS (c) VIRTUAL ); ALTER TABLE t1 ADD KEY(v); -Warnings: -Warning 1901 Function or expression '`c`' 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 '`c`' 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 '`c`' 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 +ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`c`' 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 '`c`' 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 '`c`' 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 -ALTER TABLE t1 DROP KEY v; -Warnings: -Warning 1901 Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression '`c`' 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 CREATE INDEX v ON t1 (v); -Warnings: -Warning 1901 Function or expression '`c`' 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 '`c`' 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 '`c`' 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 +ERROR HY000: Function or expression '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`c`' 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 '`c`' 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 '`c`' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 1901 Function or expression '`c`' 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; # A virtual column on the second position in an index - cannot depend on sql_mode CREATE TABLE t1 (id int, a CHAR(5), v TEXT AS (a) VIRTUAL, KEY(id, v(100))); -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 +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 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; # A persisten virtual column cannot depend on sql_mode CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT); -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 +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW WARNINGS; Level Code Message -Warning 1901 Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` +Error 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; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT); SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result b/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result index fe1cb7b5779..d3954770c7b 100644 --- a/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result +++ b/mysql-test/suite/vcol/r/vcol_sql_mode_upgrade.result @@ -52,66 +52,40 @@ 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 CREATE TABLE t2 LIKE t1; -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 t2; +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` FLUSH TABLES; CREATE TABLE t2 LIKE t1; -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 -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; +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -ALTER TABLE t1 ADD b INT DEFAULT a; 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 -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 +ALTER TABLE t1 ADD b INT DEFAULT a; +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(5) DEFAULT NULL, - `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED, - `b` int(11) DEFAULT `a` + `v` varchar(5) GENERATED ALWAYS AS (`a`) STORED ) 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; -a v b -1 1 1 -2 2 2 -3 3 3 +a v +1 1 +2 2 +3 3 FLUSH TABLES; ALTER TABLE t1 ADD c INT DEFAULT a; -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 -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 +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SELECT * FROM t1; -a v b c -1 1 1 1 -2 2 2 2 -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 +a v +1 1 +2 2 +3 3 DROP TABLE t1; # # Fixing a Maria-10.2.26 table with a stored VARCHAR column @@ -203,18 +177,10 @@ 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 CREATE TABLE t2 LIKE t1; -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 t2; +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` FLUSH TABLES; CREATE TABLE t2 LIKE t1; -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 -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; +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -222,33 +188,19 @@ t1 CREATE TABLE `t1` ( `v` varchar(5) GENERATED ALWAYS AS (`a`) VIRTUAL, KEY `v` (`v`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -ALTER TABLE t1 ADD b INT DEFAULT a; 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 -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 +ALTER TABLE t1 ADD b INT DEFAULT a; +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` FLUSH TABLES; ALTER TABLE t1 ADD c INT DEFAULT a; -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 -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 +ERROR HY000: Function or expression '`a`' cannot be used in the GENERATED ALWAYS AS clause of `v` SELECT * FROM t1; -a v b c -1 1 1 1 -2 2 2 2 -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 +a v +1 1 +2 2 +3 3 DROP TABLE t1; # # Fixing a Maria-10.2.26 table with a virtual VARCHAR column diff --git a/mysql-test/suite/vcol/t/vcol_sql_mode.test b/mysql-test/suite/vcol/t/vcol_sql_mode.test index 44d3686ac01..2f521e505cd 100644 --- a/mysql-test/suite/vcol/t/vcol_sql_mode.test +++ b/mysql-test/suite/vcol/t/vcol_sql_mode.test @@ -21,25 +21,21 @@ DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v TIME AS (a) VIRTUAL, KEY(v)); 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)); 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)); 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)); 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))); SHOW WARNINGS; -DROP TABLE t1; --echo # PAD_CHAR_TO_FULL_LENGTH + TRIM resolving dependency @@ -79,61 +75,52 @@ DROP TABLE t1; --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)); 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))); 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)); 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)); 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)); 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)); SHOW WARNINGS; -DROP TABLE t1; # more than one space -#--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)); SHOW WARNINGS; -DROP TABLE t1; # more than one space -#--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)); SHOW WARNINGS; -DROP TABLE t1; --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 ( a CHAR(5), b CHAR(5), v TEXT AS (TRIM(TRAILING b FROM a)) VIRTUAL, KEY(v(100))); SHOW WARNINGS; -DROP TABLE t1; --echo # PAD_CHAR_TO_FULL_LENGTH + RPAD resolving dependency @@ -157,12 +144,11 @@ DROP TABLE t1; --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)); 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), b CHAR(5), @@ -170,7 +156,6 @@ CREATE TABLE t1 ( KEY(v) ); SHOW WARNINGS; -DROP TABLE t1; --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)); SHOW CREATE 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) CHARACTER SET latin1 COLLATE latin1_nopad_bin, v INT AS (a='a') VIRTUAL, KEY(v) ); SHOW WARNINGS; -DROP TABLE t1; --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)); SHOW CREATE 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)); SHOW WARNINGS; -DROP TABLE t1; --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)); SHOW WARNINGS; -DROP TABLE t1; --echo # --echo # Testing NO_UNSIGNED_SUBTRACTION --echo # -#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 ( a INT UNSIGNED, b INT UNSIGNED, @@ -224,9 +206,8 @@ CREATE TABLE t1 ( KEY (c) ); 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 INT UNSIGNED, b INT UNSIGNED, @@ -234,9 +215,8 @@ CREATE TABLE t1 ( KEY (c) ); 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 INT UNSIGNED, b INT UNSIGNED, @@ -244,7 +224,6 @@ CREATE TABLE t1 ( KEY (c) ); SHOW WARNINGS; -DROP TABLE t1; CREATE TABLE t1 ( a INT UNSIGNED, @@ -271,7 +250,7 @@ DROP TABLE t1; --echo # Comnination: PAD_CHAR_TO_FULL_LENGTH + NO_UNSIGNED_SUBTRACTION --echo # -#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t1 ( a INT UNSIGNED, b INT UNSIGNED, @@ -280,14 +259,13 @@ CREATE TABLE t1 ( KEY (v) ); SHOW WARNINGS; -DROP TABLE t1; # The below solves the dependency on NO_UNSIGNED_SUBTRACTION # but does not solve the dependency on PAD_CHAR_TO_FULL_LENGTH, # 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 ( a INT UNSIGNED, b INT UNSIGNED, @@ -296,7 +274,6 @@ CREATE TABLE t1 ( KEY (v) ); SHOW WARNINGS; -DROP TABLE t1; @@ -314,12 +291,10 @@ CREATE TABLE t1 ( c CHAR(5), 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); 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); SHOW WARNINGS; 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 -#--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))); SHOW WARNINGS; -DROP TABLE t1; --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); SHOW WARNINGS; -DROP TABLE t1; CREATE TABLE t1 (a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT); SHOW CREATE TABLE t1; diff --git a/mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test b/mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test index 26b76fbcfe1..71e34231ac1 100644 --- a/mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test +++ b/mysql-test/suite/vcol/t/vcol_sql_mode_upgrade.test @@ -25,21 +25,19 @@ SELECT * FROM t1; FLUSH TABLES; SELECT * FROM t1; -#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t2 LIKE t1; -DROP TABLE t2; FLUSH TABLES; -#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t2 LIKE t1; -DROP TABLE t2; 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; SHOW CREATE TABLE t1; SELECT * FROM t1; 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; SELECT * FROM t1; DROP TABLE t1; @@ -92,20 +90,18 @@ SELECT * FROM t1; FLUSH TABLES; SELECT * FROM t1; -#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t2 LIKE t1; -DROP TABLE t2; FLUSH TABLES; -#--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED CREATE TABLE t2 LIKE t1; -DROP TABLE t2; 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; 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; SELECT * FROM t1; DROP TABLE t1; |