GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Hex string literal x'...' incorrectly parsed as keyword + string · Issue #649 · phpmyadmin/sql-parser

Hex string literal x'...' incorrectly parsed as keyword + string #649

New issue
Copy link
New issue
Copy link
Open
Open
Hex string literal x'...' incorrectly parsed as keyword + string#649
Copy link

Description

@predictor2718
predictor2718
opened on Apr 12, 2026
Issue body actions

Bug

The lexer incorrectly tokenizes hex string literals x'...' as two separate tokens (keyword x + string '...'),
causing the builder to produce invalid SQL x AS '...' instead of x'...'.

This affects CREATE TABLE statements with binary column defaults on MariaDB 11.8+ which outputs DEFAULT x'...'
in SHOW CREATE TABLE.

The b'...' binary string literal format is handled correctly — only x'...' is affected.

To Reproduce

  $parser = new Parser("CREATE TABLE test (IP binary(16) NOT NULL DEFAULT x'00000000000000000000000000000000')");
  echo $parser->statements[0]->build();                                                                               
  // Output: ... DEFAULT x AS `00000000000000000000000000000000`                                                      
  // Expected: ... DEFAULT x'00000000000000000000000000000000'

Affected versions

Both 5.11.x and master.

Root cause

The Lexer's number parsing state machine has states 7-9 for b'...' binary literals, but no equivalent states for
x'...' hex string literals. The x is instead matched as a keyword.

Activity

  1. williamdes
    added a commit that references this issue on Oct 13, 2026

    Merge #650 - Fix hex string literal (x'...') parsing in CREATE TABLE …

    This issue will close once commit 18d63ad is merged into the 'master' branch.
    18d63ad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.