Skip to content

Commit

Permalink
More details about literals
Browse files Browse the repository at this point in the history
  • Loading branch information
brunokim authored and mosabua committed Jan 23, 2025
1 parent 5916ea5 commit a54bd33
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions docs/src/main/sphinx/language/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ Integer numbers can be expressed as numeric literals in the following formats:
for decimal `9` or `0b101010` for decimal `42``.

Underscore characters are ignored within literal values, and can be used to
increase readability. For example, decimal integer `123_456.789_123` is
equivalent to `123456.789123`. Preceding and trailing underscores are not
permitted.
increase readability. For example, decimal integer `123_456` is equivalent to
`123456`. Preceding underscores, trailing underscores, and consecutive underscores
are not permitted.

Integers are supported by the following data types.

Expand Down Expand Up @@ -83,8 +83,8 @@ Floating-point, fixed-precision numbers can be expressed as numeric literal
using scientific notation such as `1.03e1` and are cast as `DOUBLE` data type.
Underscore characters are ignored within literal values, and can be used to
increase readability. For example, value `123_456.789e4` is equivalent to
`123456.789e4`. Preceding underscores, trailing underscores, and underscores
beside the comma (`.`) are not permitted.
`123456.789e4`. Preceding underscores, trailing underscores, consecutive
underscores, and underscores beside the comma (`.`) are not permitted.

### `REAL`

Expand All @@ -108,8 +108,8 @@ are supported by the `DECIMAL` data type.

Underscore characters are ignored within literal values, and can be used to
increase readability. For example, decimal `123_456.789_123` is equivalent to
`123456.789123`. Preceding underscores, trailing underscores, and underscores
beside the comma (`.`) are not permitted.
`123456.789123`. Preceding underscores, trailing underscores, consecutive
underscores, and underscores beside the comma (`.`) are not permitted.

Leading zeros in literal values are permitted and ignored. For example,
`000123.456` is equivalent to `123.456`.
Expand Down Expand Up @@ -178,6 +178,9 @@ The binary data has to use hexadecimal format. For example, the binary form of
SELECT from_utf8(x'65683F');
```

Binary literals ignore any whitespace characters. For example, the literal
`X'FFFF 0FFF 3FFF FFFF'` is equivalent to `X'FFFF0FFF3FFFFFFF'`.

:::{note}
Binary strings with length are not yet supported: `varbinary(n)`
:::
Expand Down

0 comments on commit a54bd33

Please sign in to comment.