Skip to content

SET parser: bare ON/OFF keyword values not accepted as expressions #35

@renecannao

Description

@renecannao

Problem

When a SET statement assigns a bare ON or OFF keyword as a value (e.g., SET @@sql_auto_is_null = ON), the parser does not produce a NODE_VAR_ASSIGNMENT for it. These are valid MySQL syntax for boolean-like variables.

Failing test cases

SET @@sql_auto_is_null = ON
  Expected: {"sql_auto_is_null": ["ON"]}
  Got:      {} (empty)

SET @@sql_safe_updates = ON
  Expected: {"sql_safe_updates": ["ON"]}
  Got:      {} (empty)

Root cause

The expression parser in expression_parser.h does not recognize ON or OFF as valid expression start tokens. When the SetParser encounters = ON, it fails to parse the RHS expression and the entire assignment is skipped.

Expected behavior

ON and OFF should be recognized as valid expression values in the SET parser context, producing the same output as if they were identifiers.

Context

Discovered during integration testing into ProxySQL. Test suite: setparser_test_common.h, test arrays various[17], various[22].

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