-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: syntax X'...' should be byte array not string #13049
Copy link
Copy link
Closed
Labels
C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Description
CockroachDB supports the non-standard extension syntax x'.....' to enter a literal string using hexadecimal codes only.
This is all fine and dandy but it's not so clear to me that we have a use case for it.
Meanwhile, we do have a use case for entering raw bytes containing possibly invalid UTF-8 sequences (a byte array) in hexadecimal, for example a uuid value or a SHA hash, but CockroachDB does not provide a compact syntax to do so yet -- the best we have so far is b'\xAA\xAA\xAA\xAA... which is 50% less efficient to type.
It seems to me we should simply repurpose the syntax x'....' to become a byte array literal (BCONST) instead of a string array literal (SCONST).
@jordanlewis what do you think? (You added this support initially)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)