Skip to content

Binary constant with odd number of hexadecimal digits is incorrectly processed #418

@k-rus

Description

@k-rus

Starcounter's SQL supports binaries with even or odd number of hexadecimal digits, e.g.:

SELECT m FROM MyDbClass WHERE MyBinaryValue < BINARY '12AB' and MyBinaryValue > BINARY '2AB'

Many DBMS supports only binaries with even number of hexadecimal digits, i.e., BINARY '12AB' is accepted and BINARY '2AB' is syntactical error. Some DBMSs support both and, if I don't mistake, they pad 0 on the left, i.e., BINARY '2AB' is equivalent to BINARY '02AB'

The current Starcounter implementation behaves differently: BINARY '2AB' is equivalent to BINARY '2A0B'. This seems to be a bug.

Then how should the bug be fixed:

  1. Support only even number of hexadecimal digits
  2. Support both even and odd, and padding with 0 on the left.

cc @miyconst @un-tone @LarsTjernstrom @dan31 @Starcounter/sql_tf @Starcounter/qpt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions