Skip to content

Commit 37d782d

Browse files
author
jseldess
authored
Merge pull request #392 from cockroachdb/hexadecimal-literals
hexidecimal string and numeric literals
2 parents 71e5378 + f1104ba commit 37d782d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

int.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ In CockroachDB, the following are aliases for `INT`:
2020

2121
## Format
2222

23-
When inserting into an `INT` column, format the value as `12345`.
23+
An `INT` column accepts numeric literals and hexadecimal-encoded numeric literals.
24+
25+
### Numeric Literal
26+
27+
When inserting a numeric literal into an `INT` column, format the value as `12345`.
28+
29+
### Hexadecimal-Encoded Numeric Literal
30+
31+
When inserting a hexadecimal-encoded numeric literal into a `INT` column, format the value as hexadecimal digits preceded by `0x`. For example, `0xcafe1111` corresponds to the numeric literal `3405648145`.
2432

2533
## Size
2634

string.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,19 @@ When inserting a string:
3636

3737
## Format
3838

39-
A `STRING` column accepts both string literals and escape strings.
39+
A `STRING` column accepts Unicode string literals, hexadecimal string literals, and escape strings.
4040

4141
### String Literal
4242

4343
When inserting a string literal into a `STRING` column, format the value as Unicode characters within single quotes, e.g., `'a1b2c3'`.
4444

45+
### Hexadecimal-Encoded String Literal
46+
47+
When inserting a hexadecimal-encoded string literal into a `STRING` column, format the value as `x` or `X` followed by hexadecimal digits in single quotes. For example, `x'636174'` or `X'636174'` correspond to the Unicode string literal `'cat'`.
48+
4549
### Escape String
4650

47-
When inserting an escape string into a `STRING` column, use either `e` or `E` and followed by one or more of the following backslash escape sequences within single quotes:
51+
When inserting an escape string into a `STRING` column, format the value as `e` or `E` followed by one or more of the following backslash escape sequences within single quotes:
4852

4953
Backslash Escape Sequence | Interpretation
5054
--------------------------|---------------

0 commit comments

Comments
 (0)