Skip to content

feat: expose lossless MySQL user variables - #55

Merged
renecannao merged 3 commits into
mainfrom
feature/user-variable-literals
Aug 13, 2026
Merged

feat: expose lossless MySQL user variables#55
renecannao merged 3 commits into
mainfrom
feature/user-variable-literals

Conversation

@renecannao

@renecannao renecannao commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add lossless MySQL user-variable and literal AST/token support
  • preserve exact source spelling for safe downstream replay
  • classify user-variable usage as absent, read-only, or unsafe/unknown
  • enforce full-input parsing and harden malformed/comment edge cases, including MariaDB executable comments

Why

ProxySQL currently falls back to hostgroup locking for client statements such as:

SET @browser_lang = 'en-US', @browser_time = '2026-08-11 18:11:12', @browser_timezone = 'GMT+2', @ip_address = '167.235.198.244'

The downstream consumer needs typed assignments and the exact literal spelling before it can safely track and replay these values. Reconstructing that information from normalized SQL would lose literal semantics, so ParserSQL is the source of truth.

Details

  • supports string, integer, decimal, hexadecimal, bit, and NULL literal nodes
  • supports direct +/- signs for numeric literals
  • exposes canonical user-variable identity together with lossless token/source ranges
  • detects user-variable reads and unsafe assignments without raw-text semantic guesses
  • rejects partial/malformed input conservatively
  • preserves existing emitter and digest behavior, including quoted user-variable forms

Validation

  • make test: 1,333 tests run; 1,296 passed; 37 backend-dependent tests skipped
  • make build-corpus-test: passed
  • downstream ProxySQL ParserSQL adapter: 199/199 unit assertions
  • downstream legacy ParserSQL SET comparison: 494/494 assertions

Downstream

Companion ProxySQL PR: sysown/proxysql#6043

That PR vendors the archive produced from commit db9d464c334eaba236bea16a6e9eb6efa7c3a863 and uses these typed results for bounded user-variable tracking and backend replay.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b9bacbb-d3c9-4482-8500-5804518f70ae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@renecannao
renecannao marked this pull request as ready for review August 13, 2026 12:52
@renecannao
renecannao merged commit af1e5b0 into main Aug 13, 2026
8 checks passed
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