bytebase / bytebase/omni

MariaDB: Parser fails on derived table with FOR SYSTEM_TIME clause

Open
#424 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
15
Forks
7
Avg merge
13h 2m
Merged PRs (30d)
23

Description

Summary

The MariaDB dialect parser fails to parse a valid MariaDB query when a FOR SYSTEM_TIME clause is applied to a derived table in the FROM clause.

MariaDB allows FOR SYSTEM_TIME to be used not only on base tables but also on derived tables (subqueries).

Reproduction
CREATE TABLE employees (
    id      INT NOT NULL PRIMARY KEY,
    name    VARCHAR(100) NOT NULL,
    salary  DECIMAL(10,2) NOT NULL
) WITH SYSTEM VERSIONING;



SELECT * FROM (SELECT * FROM employees) FOR SYSTEM_TIME AS OF NOW() AS drv;

got parser failed error

expected UPDATE or SHARE after FOR (line 1, column 45)
related text: SELECT * FROM (SELECT * FROM employees) FOR SYSTEM_TIME AS OF NOW() AS drv;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by reproducing the MariaDB dialect parser failure with the provided CREATE TABLE and SELECT query, then locate the parser entry point for FOR SYSTEM_TIME on a derived table; done means the query parses successfully without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.