You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.8 KiB

  1. -- source include/have_innodb.inc
  2. -- source include/not_embedded.inc
  3. select @@system_versioning_transaction_registry;
  4. --error ER_VERS_TRT_IS_DISABLED
  5. create or replace table t1 (
  6. x int,
  7. sys_trx_start bigint(20) unsigned as row start invisible,
  8. sys_trx_end bigint(20) unsigned as row end invisible,
  9. period for system_time (sys_trx_start, sys_trx_end)
  10. ) with system versioning engine innodb;
  11. set global system_versioning_transaction_registry= 1;
  12. create or replace table t1 (
  13. x int,
  14. sys_trx_start bigint(20) unsigned as row start invisible,
  15. sys_trx_end bigint(20) unsigned as row end invisible,
  16. period for system_time (sys_trx_start, sys_trx_end)
  17. ) with system versioning engine innodb;
  18. insert into t1 (x) values (1);
  19. set global system_versioning_transaction_registry= 0;
  20. --error ER_VERS_TRT_IS_DISABLED
  21. insert into t1 (x) values (2);
  22. --error ER_VERS_TRT_IS_DISABLED
  23. delete from t1;
  24. --error ER_VERS_TRT_IS_DISABLED
  25. update t1 set x= 3;
  26. --echo # ALTER ADD SYSTEM VERSIONING should write to mysql.transaction_registry
  27. create function check_result (cond boolean)
  28. returns char(50) deterministic
  29. return if(cond = 1, '[CORRECT]', '[INCORRECT]');
  30. set @@system_versioning_alter_history=keep;
  31. set global system_versioning_transaction_registry=on;
  32. create or replace table t1 (x int) engine innodb;
  33. insert into t1 values (1);
  34. alter table t1
  35. add column s bigint unsigned as row start,
  36. add column e bigint unsigned as row end,
  37. add period for system_time(s, e),
  38. add system versioning,
  39. algorithm=inplace;
  40. select s from t1 into @trx_start;
  41. select check_result(count(*) = 1) from mysql.transaction_registry where transaction_id = @trx_start;
  42. create or replace table t1 (x int) engine innodb;
  43. select count(*) from mysql.transaction_registry into @tmp;
  44. alter table t1
  45. add column s bigint unsigned as row start,
  46. add column e bigint unsigned as row end,
  47. add period for system_time(s, e),
  48. add system versioning,
  49. algorithm=inplace;
  50. select check_result(count(*) = @tmp) from mysql.transaction_registry;
  51. create or replace table t1 (x int) engine innodb;
  52. insert into t1 values (1);
  53. alter table t1
  54. add column s bigint unsigned as row start,
  55. add column e bigint unsigned as row end,
  56. add period for system_time(s, e),
  57. add system versioning,
  58. algorithm=copy;
  59. select s from t1 into @trx_start;
  60. select check_result(count(*) = 1) from mysql.transaction_registry where transaction_id = @trx_start;
  61. create or replace table t1 (x int) engine innodb;
  62. select count(*) from mysql.transaction_registry into @tmp;
  63. alter table t1
  64. add column s bigint unsigned as row start,
  65. add column e bigint unsigned as row end,
  66. add period for system_time(s, e),
  67. add system versioning,
  68. algorithm=copy;
  69. select check_result(count(*) = @tmp) from mysql.transaction_registry;
  70. drop table t1;
  71. set global system_versioning_transaction_registry=off;
  72. drop function check_result;