1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-22597 Add views for periods in information_schema

Two new information_schema views are added:
* PERIOD table -- columns TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME,
  PERIOD_NAME, START_COLUMN_NAME, END_COLUMN_NAME.
* KEY_PERIOD_USAGE -- works similar to KEY_COLUMN_USAGE, but for periods.
  Columns CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME,
  TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, PERIOD_NAME

Two new columns are added to the COLUMNS view:
 IS_SYSTEM_TIME_PERIOD_START, IS_SYSTEM_TIME_PERIOD_END - contain YES/NO.
This commit is contained in:
Nikita Malyavin
2023-08-30 01:04:34 +04:00
committed by Oleksandr Byelkin
parent 85f9df29c0
commit 4246c0fa01
37 changed files with 4840 additions and 4102 deletions

View File

@@ -1,3 +1,5 @@
select * from information_schema.periods;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PERIOD START_COLUMN_NAME END_COLUMN_NAME
create table t1 (
x1 int unsigned,
Sys_start SYS_DATATYPE as row start invisible comment 'start',
@@ -12,6 +14,15 @@ t1 CREATE TABLE `t1` (
`Sys_end` SYS_DATATYPE GENERATED ALWAYS AS ROW END INVISIBLE COMMENT 'end',
PERIOD FOR SYSTEM_TIME (`Sys_start`, `Sys_end`)
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
select * from information_schema.periods where table_name = 't1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PERIOD START_COLUMN_NAME END_COLUMN_NAME
def test t1 SYSTEM_TIME Sys_start Sys_end
select column_name, is_system_time_period_start, is_system_time_period_end
from information_schema.columns where table_name = 't1';
column_name is_system_time_period_start is_system_time_period_end
x1 NO NO
Sys_start YES NO
Sys_end NO YES
select table_catalog,table_schema,table_name,table_type,version,table_rows,data_free,auto_increment,check_time,table_collation,checksum,create_options,table_comment from information_schema.tables where table_name='t1';
table_catalog def
table_schema test
@@ -81,6 +92,12 @@ Table Create Table
t1 CREATE TABLE `t1` (
`x2` int(10) unsigned DEFAULT NULL
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
select * from information_schema.periods where table_name = 't1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PERIOD START_COLUMN_NAME END_COLUMN_NAME
select column_name, is_system_time_period_start, is_system_time_period_end
from information_schema.columns where table_name = 't1';
column_name is_system_time_period_start is_system_time_period_end
x2 NO NO
create or replace table t1 (
x3 int unsigned,
Sys_start timestamp(6) as row start invisible,