1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Timestamp-based versioning for InnoDB [closes #209]

* Removed integer_fields check
* Reworked Vers_parse_info::check_sys_fields()
* Misc renames
* versioned as vers_sys_type_t

* Removed versioned_by_sql(), versioned_by_engine()

versioned() works as before;
versioned(VERS_TIMESTAMP) is versioned_by_sql();
versioned(VERS_TRX_ID) is versioned_by_engine().

* create_tmp_table() fix
* Foreign constraints for timestamp-based
* Range auto-specifier fix
* SQL: 1-row partition rotation fix [fixes #260]
* Fix 'drop system versioning, algorithm=inplace'
This commit is contained in:
Aleksey Midenkov
2017-12-18 19:03:51 +03:00
committed by GitHub
parent d5e37621cf
commit b55a149194
73 changed files with 1178 additions and 836 deletions

View File

@@ -1,3 +1,6 @@
#################
# Test RESTRICT #
#################
create table parent(
id int unique key
) engine innodb;
@@ -25,6 +28,9 @@ parent_id
1
drop table child;
drop table parent;
##############################################
# Test when clustered index is a foreign key #
##############################################
create table parent(
id int(10) unsigned unique key
) engine innodb;
@@ -38,6 +44,9 @@ delete from parent where id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
drop table child;
drop table parent;
################
# Test CASCADE #
################
create table parent(
id int unique key
) engine innodb;
@@ -49,6 +58,12 @@ on update cascade
) engine innodb with system versioning;
insert into parent values(1);
insert into child values(1);
## FIXME: #415 update of foreign constraints is disabled
call mtr.add_suppression("foreign key constraints in timestamp-based temporal table");
delete from parent where id = 1;
ERROR 42000: Table 'parent' uses an extension that doesn't exist in this MariaDB version
delete from child where parent_id = 1;
## FIXME END
delete from parent where id = 1;
select * from child;
parent_id
@@ -102,6 +117,9 @@ on update restrict
engine innodb;
insert into parent (id) values (3);
insert into child (id, parent_id) values (3, 3);
## FIXME: #415 update of foreign constraints is disabled
delete from child;
## FIXME END
delete from parent;
select * from child;
id parent_id
@@ -110,6 +128,9 @@ id parent_id
3 3
drop table child;
drop table parent;
#################
# Test SET NULL #
#################
create table parent(
id int unique key
) engine innodb;
@@ -123,28 +144,24 @@ insert into parent values(1);
insert into child values(1);
delete from child;
insert into child values(1);
## FIXME: #415 update of foreign constraints is disabled
delete from child where parent_id = 1;
## FIXME END
delete from parent where id = 1;
select * from child;
parent_id
NULL
select * from child for system_time from timestamp '1-1-1' to timestamp now(6);
parent_id
1
NULL
1
delete from child;
insert into parent values(1);
insert into child values(1);
update parent set id=id+1;
select * from child;
parent_id
NULL
select * from child for system_time from timestamp '1-1-1' to timestamp now(6);
parent_id
1
NULL
NULL
drop table child;
drop table parent;
###########################
# Parent table is foreign #
###########################
create or replace table parent(
id int unique key
) engine innodb with system versioning;
@@ -170,6 +187,9 @@ update parent set id=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
drop table child;
drop table parent;
###################
# crash on DELETE #
###################
create or replace table a (
cola int(10) primary key,
v_cola int(10) as (cola mod 10) virtual