Skip to content

[BUG] JSQLParser 5.4-SNAPSHOT : MySQL : 0x hexadecimal literal (0xFF) not supported as select item #2435

Description

@tomershay

Failing SQL Feature

MySQL supports a hexadecimal literal shorthand using the 0x prefix, e.g. 0xFF. In numeric contexts it evaluates to its integer value (0xFF = 255); otherwise it is treated as a binary string. This is a MySQL-specific form (distinct from the SQL-standard x'1F' hex-string literal) and is commonly used to express byte/hex constants.

See the MySQL docs:
https://dev.mysql.com/doc/refman/8.0/en/hexadecimal-literals.html

SQL Example

CREATE TABLE t (
  id INT PRIMARY KEY
);

INSERT INTO t (id) VALUES (1);

SELECT 0xFF FROM t;

Parsing error

ParseException: Encountered: <S_IDENTIFIER> / "t", at line 1, column 18, in lexical state DEFAULT.

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