diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/vcol/r/innodb_virtual_fk.result | |
parent | Initial commit. (diff) | |
download | mariadb-upstream.tar.xz mariadb-upstream.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/vcol/r/innodb_virtual_fk.result')
-rw-r--r-- | mysql-test/suite/vcol/r/innodb_virtual_fk.result | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/r/innodb_virtual_fk.result b/mysql-test/suite/vcol/r/innodb_virtual_fk.result new file mode 100644 index 00000000..419603c1 --- /dev/null +++ b/mysql-test/suite/vcol/r/innodb_virtual_fk.result @@ -0,0 +1,101 @@ +set default_storage_engine=innodb; +create table t1 (id int primary key, id2 int as (id) virtual, key id2 (id2)); +create table t2 (id int key, constraint fk_id foreign key (id) references t1 (id) on delete cascade); +insert into t1 (id) values (1), (2); +insert into t2 (id) values (1), (2); +delete from t1; +select * from t1; +id id2 +select * from t2; +id +drop table t2; +drop table t1; +# +# End of 10.2 tests +# +# +# MDEV-18114 Foreign Key Constraint actions don't affect Virtual Column +# +create table t1 (id int primary key); +create or replace table t2 (id int, id2 int as (id) virtual, key(id2), foreign key (id) references t1 (id) on update restrict); +create or replace table t2 (id int, id2 int as (id) virtual, key(id2), foreign key (id) references t1 (id) on update no action); +create or replace table t2 (id int, id2 int as (id) virtual, key(id2), foreign key (id) references t1 (id) on delete cascade); +create or replace table t2 (id int, id2 int as (id) virtual, key(id2), foreign key (id) references t1 (id) on update cascade); +create or replace table t2 (id int, id2 int as (id) virtual, key(id2), foreign key (id) references t1 (id) on delete set null); +create or replace table t2 (id int, id2 int as (id) virtual, key(id2), foreign key (id) references t1 (id) on update set null); +create or replace table t2 (id int, id2 int as (id) stored, foreign key (id) references t1 (id) on update restrict); +create or replace table t2 (id int, id2 int as (id) stored, foreign key (id) references t1 (id) on update no action); +create or replace table t2 (id int, id2 int as (id) stored, foreign key (id) references t1 (id) on delete cascade); +create or replace table t2 (id int, id2 int as (id) stored, foreign key (id) references t1 (id) on update cascade); +ERROR HY000: Function or expression 'id' cannot be used in the GENERATED ALWAYS AS clause of `id2` +create or replace table t2 (id int, id2 int as (id) stored, foreign key (id) references t1 (id) on delete set null); +ERROR HY000: Function or expression 'id' cannot be used in the GENERATED ALWAYS AS clause of `id2` +create or replace table t2 (id int, id2 int as (id) stored, foreign key (id) references t1 (id) on update set null); +ERROR HY000: Function or expression 'id' cannot be used in the GENERATED ALWAYS AS clause of `id2` +create or replace table t2 (id int, id2 int as (id) virtual, id3 int as (id2) stored, foreign key (id) references t1 (id) on update restrict); +create or replace table t2 (id int, id2 int as (id) virtual, id3 int as (id2) stored, foreign key (id) references t1 (id) on update no action); +create or replace table t2 (id int, id2 int as (id) virtual, id3 int as (id2) stored, foreign key (id) references t1 (id) on delete cascade); +create or replace table t2 (id int, id2 int as (id) virtual, id3 int as (id2) stored, foreign key (id) references t1 (id) on update cascade); +ERROR HY000: Function or expression 'id2' cannot be used in the GENERATED ALWAYS AS clause of `id3` +create or replace table t2 (id int, id2 int as (id) virtual, id3 int as (id2) stored, foreign key (id) references t1 (id) on delete set null); +ERROR HY000: Function or expression 'id2' cannot be used in the GENERATED ALWAYS AS clause of `id3` +create or replace table t2 (id int, id2 int as (id) virtual, id3 int as (id2) stored, foreign key (id) references t1 (id) on update set null); +ERROR HY000: Function or expression 'id2' cannot be used in the GENERATED ALWAYS AS clause of `id3` +create or replace table t2 (id int, id2 int default (id), foreign key (id) references t1 (id) on update restrict); +create or replace table t2 (id int, id2 int default (id), foreign key (id) references t1 (id) on update no action); +create or replace table t2 (id int, id2 int default (id), foreign key (id) references t1 (id) on delete cascade); +create or replace table t2 (id int, id2 int default (id), foreign key (id) references t1 (id) on update cascade); +create or replace table t2 (id int, id2 int default (id), foreign key (id) references t1 (id) on delete set null); +create or replace table t2 (id int, id2 int default (id), foreign key (id) references t1 (id) on update set null); +create or replace table t2 (id int, id2 int check (id), foreign key (id) references t1 (id) on update restrict); +create or replace table t2 (id int, id2 int check (id), foreign key (id) references t1 (id) on update no action); +create or replace table t2 (id int, id2 int check (id), foreign key (id) references t1 (id) on delete cascade); +create or replace table t2 (id int, id2 int check (id), foreign key (id) references t1 (id) on update cascade); +ERROR HY000: Function or expression 'id' cannot be used in the CHECK clause of `id2` +create or replace table t2 (id int, id2 int check (id), foreign key (id) references t1 (id) on delete set null); +ERROR HY000: Function or expression 'id' cannot be used in the CHECK clause of `id2` +create or replace table t2 (id int, id2 int check (id), foreign key (id) references t1 (id) on update set null); +ERROR HY000: Function or expression 'id' cannot be used in the CHECK clause of `id2` +create or replace table t2 (id int, id2 int, check (id), foreign key (id) references t1 (id) on update restrict); +create or replace table t2 (id int, id2 int, check (id), foreign key (id) references t1 (id) on update no action); +create or replace table t2 (id int, id2 int, check (id), foreign key (id) references t1 (id) on delete cascade); +create or replace table t2 (id int, id2 int, check (id), foreign key (id) references t1 (id) on update cascade); +ERROR HY000: Function or expression 'id' cannot be used in the CHECK clause of `CONSTRAINT_1` +create or replace table t2 (id int, id2 int, check (id), foreign key (id) references t1 (id) on delete set null); +ERROR HY000: Function or expression 'id' cannot be used in the CHECK clause of `CONSTRAINT_1` +create or replace table t2 (id int, id2 int, check (id), foreign key (id) references t1 (id) on update set null); +ERROR HY000: Function or expression 'id' cannot be used in the CHECK clause of `CONSTRAINT_1` +create or replace table t2 (id int, id2 int as (id) virtual, check (id2), foreign key (id) references t1 (id) on update restrict); +create or replace table t2 (id int, id2 int as (id) virtual, check (id2), foreign key (id) references t1 (id) on update no action); +create or replace table t2 (id int, id2 int as (id) virtual, check (id2), foreign key (id) references t1 (id) on delete cascade); +create or replace table t2 (id int, id2 int as (id) virtual, check (id2), foreign key (id) references t1 (id) on update cascade); +ERROR HY000: Function or expression 'id2' cannot be used in the CHECK clause of `CONSTRAINT_1` +create or replace table t2 (id int, id2 int as (id) virtual, check (id2), foreign key (id) references t1 (id) on delete set null); +ERROR HY000: Function or expression 'id2' cannot be used in the CHECK clause of `CONSTRAINT_1` +create or replace table t2 (id int, id2 int as (id) virtual, check (id2), foreign key (id) references t1 (id) on update set null); +ERROR HY000: Function or expression 'id2' cannot be used in the CHECK clause of `CONSTRAINT_1` +drop table if exists t2, t1; +Warnings: +Note 1051 Unknown table 'test.t2' +# +# MDEV-31853 Assertion failure in Column_definition::check_vcol_for_key upon adding FK +# +create table t (a int, b int, c int generated always as (a), key(b), key(c)); +alter table t add foreign key (a) references t (b) on update set null, algorithm=nocopy; +ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY +alter table t add foreign key (a) references t (b); +show create table t; +Table Create Table +t CREATE TABLE `t` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL, + KEY `b` (`b`), + KEY `c` (`c`), + KEY `a` (`a`), + CONSTRAINT `t_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t; +# +# End of 10.5 tests +# |