From a9f0fb241971f657c62340355e2fb72678e60e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=B6llerer?= Date: Wed, 20 May 2026 16:11:54 +0200 Subject: [PATCH] add information on unsigned integers and tinyint --- content/compatibility/sql_features.md | 4 ++++ content/references/datatypes/_index.md | 11 ++++++--- content/references/datatypes/integer.md | 30 ++++++++++++++++--------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/content/compatibility/sql_features.md b/content/compatibility/sql_features.md index 0a66f2e..09569ca 100644 --- a/content/compatibility/sql_features.md +++ b/content/compatibility/sql_features.md @@ -186,6 +186,10 @@ the [system table compatibility](../system_table) page. | uuid | Yes | [UUID Documentation](/docs/references/datatypes/uuid) | | xml | No | | +CedarDB also supports additional integer types not present in PostgreSQL: +`tinyint` (`int1`, 8-bit signed), and unsigned variants `uint1`, `uint2`, `uint4`, `uint8`. +See the [Integer Documentation](/docs/references/datatypes/integer) for details. + ### Operators & Functions #### Logical diff --git a/content/references/datatypes/_index.md b/content/references/datatypes/_index.md index 8925a7c..35d00fb 100644 --- a/content/references/datatypes/_index.md +++ b/content/references/datatypes/_index.md @@ -10,7 +10,7 @@ We additionally support additional ones popularized by PostgreSQL (e.g., `array` The complete list of supported data types in CedarDB is as follows: * [`array`](array) -* [`bigint`](integer) +* [`bigint`](integer) (`int8`) * [`bignumeric`](numeric) * [`bit`](bit) * [`bit varying`](bit) @@ -24,16 +24,21 @@ The complete list of supported data types in CedarDB is as follows: * [`double precision`](float) * [`enum`](enums) * [`float`](float) -* [`integer`](integer) +* [`integer`](integer) (`int4`) * [`interval`](interval) * [`json`](json) * [`jsonb`](json) * [`numeric`](numeric) * [`real`](float) -* [`smallint`](integer) +* [`smallint`](integer) (`int2`) +* [`tinyint`](integer) (`int1`) * [`text`](text) * [`time`](time) * [`timestamp`](timestamp) (with or without time zone) +* [`uint1`](integer) +* [`uint2`](integer) +* [`uint4`](integer) +* [`uint8`](integer) * [`uuid`](uuid) * [`varchar`](text) * [`vector`](vector) diff --git a/content/references/datatypes/integer.md b/content/references/datatypes/integer.md index 05c4726..1071952 100644 --- a/content/references/datatypes/integer.md +++ b/content/references/datatypes/integer.md @@ -6,10 +6,14 @@ weight: 10 --- Integers are whole numbers that are typically used to represent counters or identifiers. -CedarDB supports three different widths of integers: -* A two-byte `smallint`, -* a four-byte `integer`, -* and an eight-byte `bigint`. +CedarDB supports the following signed integer types: + +* A one-byte `tinyint` (alias: `int1`), +* a two-byte `smallint` (alias: `int2`), +* a four-byte `integer` (alias: `int4`), +* and an eight-byte `bigint` (alias: `int8`). + +CedarDB also supports unsigned variants for each width: `uint1`, `uint2`, `uint4`, and `uint8`. ## Usage Example ```sql @@ -31,11 +35,18 @@ select id from example; ## Value Range -| Type | Min | Max | -|------------|----------:|-----------:| -| `smallint` | $-2^{15}$ | $2^{15}-1$ | -| `integer` | $-2^{31}$ | $2^{31}-1$ | -| `bigint` | $-2^{63}$ | $2^{63}-1$ | +### Signed + +| Type | Min | Max | +|---------------------|----------:|-----------:| +| `tinyint` (`int1`) | $-2^{7}$ | $2^{7}-1$ | +| `smallint` (`int2`) | $-2^{15}$ | $2^{15}-1$ | +| `integer` (`int4`) | $-2^{31}$ | $2^{31}-1$ | +| `bigint` (`int8`) | $-2^{63}$ | $2^{63}-1$ | +| `uint1` | $0$ | $2^{8}-1$ | +| `uint2` | $0$ | $2^{16}-1$ | +| `uint4` | $0$ | $2^{32}-1$ | +| `uint8` | $0$ | $2^{64}-1$ | Storing values outside of the supported ranges will result in an overflow exception. Operations on integers are range checked, so that e.g., numeric overflows will never cause wrong results. @@ -83,4 +94,3 @@ select i::bigint + i from integers; 2147483648 (2 rows) ``` -