Skip to content

Add support for MariaDB system-versioned tables and the SEQUENCE table option - #683

Open
xmaks82 wants to merge 2 commits into
phpmyadmin:5.11.xfrom
xmaks82:mariadb-system-versioning
Open

xmaks82 wants to merge 2 commits into
phpmyadmin:5.11.xfrom
xmaks82:mariadb-system-versioning

Conversation

@xmaks82

@xmaks82 xmaks82 commented Oct 23, 2026

Copy link
Copy Markdown

Fixes #235

SHOW CREATE TABLE of a system-versioned table (MariaDB 10.3.4+) could not be parsed. Checked with MariaDB 11.8:

CREATE TABLE `t` (
  `x` int(11) DEFAULT NULL,
  `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE,
  `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE,
  PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
) ENGINE=InnoDB WITH SYSTEM VERSIONING;

Before (context MariaDb110800):

A comma or a closing bracket was expected. (near "START")
Unexpected beginning of statement. (near "6")
Unrecognized statement type. (near "GENERATED ALWAYS")

and build() returned the table cut after `row_start` timestamp(6) GENERATED ALWAYS AS ROW. After: no errors, and the statement is built back with all columns, the period and the table option.

Changes:

  • AS ROW START, AS ROW END, WITH SYSTEM VERSIONING, WITHOUT SYSTEM VERSIONING and PERIOD FOR SYSTEM_TIME (K) added to the MariaDB 10.3+ files in tools/contexts, contexts regenerated with tools/ContextGenerator.php. MySQL contexts are not changed.
  • Column options AS ROW START, AS ROW END, WITH SYSTEM VERSIONING, WITHOUT SYSTEM VERSIONING; table option WITH SYSTEM VERSIONING.
  • Second commit: table option SEQUENCE. MariaDB prints ) ENGINE=InnoDB SEQUENCE=1 for a sequence, and the option was silently dropped from the built statement.

Docs:

Tests: parser fixtures parseCreateTableSystemVersioning_mariadb_100300, parseCreateTableSystemVersioning2_mariadb_100300 (column WITHOUT SYSTEM VERSIONING), parseCreateTableSequence_mariadb_100300, and two round-trip tests in tests/Builder/CreateStatementTest.php.

Магда М.Г. added 2 commits October 23, 2026 12:29
Parse the column options AS ROW START, AS ROW END and
WITH/WITHOUT SYSTEM VERSIONING, the PERIOD FOR SYSTEM_TIME
definition and the WITH SYSTEM VERSIONING table option.
They are available since MariaDB 10.3.4.

Fixes phpmyadmin#235

Signed-off-by: Магда М.Г. <mail@mgmagda.ru>
SHOW CREATE TABLE prints SEQUENCE=1 for sequence tables
since MariaDB 10.3. The option was silently dropped.

Signed-off-by: Магда М.Г. <mail@mgmagda.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant