Skip to content

fix(sql): treat X'...' as binary literal#19608

Open
sundy-li wants to merge 1 commit intodatabendlabs:mainfrom
sundy-li:issue-19600-20260324-2030
Open

fix(sql): treat X'...' as binary literal#19608
sundy-li wants to merge 1 commit intodatabendlabs:mainfrom
sundy-li:issue-19600-20260324-2030

Conversation

@sundy-li
Copy link
Member

@sundy-li sundy-li commented Mar 24, 2026

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

  • parse X'...' as a binary literal instead of routing it through the unsigned hex integer path
  • keep MySQL-style 0x... literals as numeric literals
  • add parser, function-layer, and sqllogictest regression coverage for the new semantics

Tests

  • cargo test -p databend-common-ast
  • cargo test -p databend-common-functions --test it type_check::test_pg_hex_literal_type_check -- --nocapture
  • cargo test -p databend-common-sql --test it --no-run
  • cargo clippy -p databend-common-ast --tests -- -D warnings
  • cargo run -p databend-sqllogictests -- --run_file binary_format.test --handlers mysql (requires a running Databend server on 127.0.0.1:3307; connection was refused in this environment)

Fixes #19600


This change is Reviewable

@github-actions github-actions bot added the pr-bugfix this PR patches a bug in codebase label Mar 24, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2026

At least one type of change must be checked in the PR description.
@sundy-li please update it 🙏.

@sundy-li sundy-li added the agent-reviewable Ready for agent review label Mar 24, 2026
@github-actions
Copy link
Contributor

🤖 CI Job Analysis

Workflow: 23490482570

📊 Summary

  • Total Jobs: 25
  • Failed Jobs: 2
  • Retryable: 0
  • Code Issues: 2

NO RETRY NEEDED

All failures appear to be code/test issues requiring manual fixes.

🔍 Job Details

  • linux / test_unit: Not retryable (Code/Test)
  • linux / check: Not retryable (Code/Test)

🤖 About

Automated analysis using job annotations to distinguish infrastructure issues (auto-retried) from code/test issues (manual fixes needed).

@sundy-li
Copy link
Member Author

Blocking issue:

The new Literal::Binary variant is not handled in src/tests/sqlsmith/src/query_fuzzer.rs:554, so the workspace no longer compiles. CI is failing with error[E0004]: non-exhaustive patterns: &databend_common_ast::ast::Literal::Binary(_) not covered in fuzz_literal_bad_value(). Please thread the new literal variant through sqlsmith before merging.

@sundy-li sundy-li added agent-approved Approved by agent and removed agent-reviewable Ready for agent review labels Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved Approved by agent pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Incorrect implementation of Hex Literal X'...' (Inconsistent with SQL Standard)

1 participant