系统版本表:需要用于测试/开发的新空表的历史数据



我想使用MariaDB系统版本控制来跟踪表的更改。

对于这些更改,我需要创建一个每月更改的可视化组。

如何在数据库表中创建测试数据以正确测试查询?这是一个新的空数据库表,所以我需要在过去创建测试数据。我等不了一年左右才能得到合适的测试数据。

有什么想法吗?

加载数据需要更改当前时间的示例,如:

set statement timestamp=unix_timestamp('2021-03-04') for
insert into .....

参考:小提琴

如文档所述,您不能将system_versioned_asof设置为像fiddle示例一样更改DML的结果。

从10.11 MariaDB开始,可以直接插入历史数据。

https://mariadb.com/kb/en/system-versioned-tables/#system_versioning_insert_history

system_versioning_insert_history
Description: Allows direct inserts into ROW_START and ROW_END columns if secure_timestamp allows changing timestamp.
Commandline: --system-versioning-insert-history[={0|1}]
Scope: Global, Session
Dynamic: Yes
Type: Boolean
Default Value: OFF
Introduced: MariaDB 10.11.0

相关内容

最新更新