From ae53f684d3d02c1ef342891087fa0326b601c2fd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 27 Nov 2022 14:09:01 +0100 Subject: MDEV-30016 Virtual columns do not support autoincrement columns change vcol_upgrade test to use stored gcols --- mysql-test/suite/vcol/r/upgrade.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/suite/vcol') diff --git a/mysql-test/suite/vcol/r/upgrade.result b/mysql-test/suite/vcol/r/upgrade.result index fea6588a5f3..5393a3543dc 100644 --- a/mysql-test/suite/vcol/r/upgrade.result +++ b/mysql-test/suite/vcol/r/upgrade.result @@ -6,7 +6,7 @@ show create table vcol_autoinc; Table Create Table vcol_autoinc CREATE TABLE `vcol_autoinc` ( `pk` int(11) NOT NULL AUTO_INCREMENT, - `v3` int(11) GENERATED ALWAYS AS (`pk`) VIRTUAL, + `v3` int(11) GENERATED ALWAYS AS (`pk`) STORED, PRIMARY KEY (`pk`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci select * from vcol_autoinc; -- cgit v1.2.1 From 37bfe32c6d4a65ea7b8297817e01954d6212c863 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 27 Nov 2022 00:03:04 +0100 Subject: try harder to reject not strictly deterministic vcols in indexes/stored detect non-determinism in vcol of vcol, like: create table t1 (a int, b real as (rand()), c real as (b) stored); --- mysql-test/suite/vcol/r/not_supported.result | 13 +++++++++++++ mysql-test/suite/vcol/t/not_supported.test | 15 +++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'mysql-test/suite/vcol') diff --git a/mysql-test/suite/vcol/r/not_supported.result b/mysql-test/suite/vcol/r/not_supported.result index d8703f755da..37ce4865dcc 100644 --- a/mysql-test/suite/vcol/r/not_supported.result +++ b/mysql-test/suite/vcol/r/not_supported.result @@ -42,3 +42,16 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp # # End of 10.2 tests # +create table t1 (a int, b real as (rand()), c real as (b) stored); +ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` +create table t1 (a int, b real as (rand()), c real as (b) unique); +ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` +create table t1 (a int auto_increment primary key, +b int as (a+1), c int as (b+1) stored); +ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` +create table t1 (a int auto_increment primary key, +b int as (a+1), c int as (b+1) unique); +ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/vcol/t/not_supported.test b/mysql-test/suite/vcol/t/not_supported.test index 2b5baf4ff4b..d58b207a7eb 100644 --- a/mysql-test/suite/vcol/t/not_supported.test +++ b/mysql-test/suite/vcol/t/not_supported.test @@ -49,3 +49,18 @@ create table t1 (a int, b serial as (a+1)); --echo # --echo # End of 10.2 tests --echo # + +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b real as (rand()), c real as (b) stored); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int, b real as (rand()), c real as (b) unique); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int auto_increment primary key, + b int as (a+1), c int as (b+1) stored); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int auto_increment primary key, + b int as (a+1), c int as (b+1) unique); + +--echo # +--echo # End of 10.3 tests +--echo # -- cgit v1.2.1