Skip to content

Support SET PERSIST / SET PERSIST_ONLY / RESET PERSIST #28

@kyleconroy

Description

@kyleconroy

Summary

Marino does not parse SET PERSIST, SET PERSIST_ONLY, or RESET PERSIST. These are the canonical way to write durable system-variable changes from a SQL session.

MySQL version

Introduced in MySQL 8.0.11 (the same version marino targets — but the variants are not in marino's grammar).

Current state in marino

grep -in '\\bPERSIST\\b\|\\bPERSIST_ONLY\\b' parser/parser.y parser/keywords.go returns no matches. STATS_PERSISTENT exists but is unrelated.

Example SQL

SET PERSIST max_connections = 200;
SET PERSIST_ONLY max_connections = 250;
SET PERSIST sql_mode = 'TRADITIONAL';

Multiple settings in one statement:

SET PERSIST
  max_connections = 200,
  long_query_time = 0.5;

Clearing persisted settings:

RESET PERSIST max_connections;
RESET PERSIST IF EXISTS max_connections;
RESET PERSIST;

Validation

All forms above run successfully against MySQL 9.2.0 Community.

Notes for the implementer

  • Add PERSIST and PERSIST_ONLY as non-reserved keywords.
  • Extend the SET statement so each variable assignment can carry a scope flag (SESSION / GLOBAL / PERSIST / PERSIST_ONLY). The scope keyword may appear either as SET PERSIST x=... or as SET @@PERSIST.x = ....
  • Add ResetPersistStmt AST node with optional IF EXISTS and optional variable name (no name = clear all).
  • Reference: https://dev.mysql.com/doc/refman/9.2/en/set-variable.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions