Provides the SQL data types available in Firebolt.
Category | Data Type | Aliases | Description |
---|---|---|---|
Numeric | INTEGER | INT, INT4 | A four-byte signed integer. |
BIGINT | LONG, INT8 | An eight-byte signed integer. | |
NUMERIC | DECIMAL | An exact numeral defined by a fixed precision and scale, with a default of 38 for precision and 9 for scale. | |
REAL | FLOAT4 | A four-bye floating point number with six decimal digits of precision. | |
DOUBLE PRECISION | DOUBLE, FLOAT, FLOAT8, FLOAT(p) | An eight-byte floating point number with fifteen decimal digits of precision. | |
Boolean | BOOLEAN | BOOL | A logical boolean value of true or false. |
Composite | ARRAY | An array that holds multiple values of the same data type. | |
STRUCT | Named values of varying data types grouped in a defined structure. | ||
Date & Timestamp | DATE | A calendar date including the year, month, and day. | |
TIMESTAMP | A calendar date and time in Coordinated Universal Time (UTC), including the year, month, day, hour, minute, second, and microsecond. | ||
TIMESTAMPTZ | A calendar date and time in the local timezone, including year, month, day, hour, minute, second, and microsecond. | ||
String | TEXT | A character string of variable length. | |
Binary | BYTEA | Binary data of variable length. | |
Spatial | GEOGRAPHY | Geographic data, including points, LineStrings, Polygons and collections thereof. |
INTEGER
data types require 4 bytes of storage.
Aliases: INT
, INT4
.
BIGINT
data types require 8 bytes of storage.
Aliases: LONG
, INT8
.
DECIMAL
.
REAL
data types require 4 bytes of storage.
Aliases: FLOAT4
.
DOUBLE
data types require 8 bytes.
Aliases: DOUBLE
, FLOAT
, FLOAT8
, FLOAT(p)
where 25 <= p <= 53
.
TRUE
or FALSE
.
Aliases: BOOL
ARRAY(<data-type> [NULL | NOT NULL])
<data-type> ARRAY
<data-type>[]
demo_array
column of TEXT
elements:
ARRAY(<data-type> NOT NULL)
syntax.
You can access a specific array element with an array subscript expression: array_value[index]
.
The supplied index must be of type INT
or BIGINT
.
An array of n elements starts with array_value[1]
and ends with array_value[n]
.
Array subscript expressions:
CREATE TABLE
statement shows arrays of different element types and different nullabilities.
INSERT INTO
statement demonstrates examples of values for these arrays:
Type | Size | Min | Max | Resolution |
---|---|---|---|---|
DATE | 4 bytes | 0001-01-01 | 9999-12-31 | 1 day |
TIMESTAMP | 8 bytes | 0001-01-01 00:00:00.000000 | 9999-12-31 23:59:59.999999 | 1 microsecond |
TIMESTAMPTZ | 8 bytes | 0001-01-01 00:00:00.000000 UTC | 9999-12-31 23:59:59.999999 UTC | 1 microsecond |
TEXT
type can be used to store character strings of any length using the UTF-8 encoding standard.
Only the ASCII letters “A” through “Z” and “a” through “z” are classified as letters (e.g., UPPER('aäuü')
returns 'AäUü'
).
The sort order of two strings is determined using the collation ucs_basic
, which sorts strings by Unicode code point (e.g., 'Ab' < 'ab'
is true as A
(U+0041
) is less than a
(U+0061
)).
The character with code zero cannot be in a string.
Regular string literals are enclosed in single quotes and don’t recognize escape sequences.
Write two adjacent single quotes to include a single-quote character within a string literal (e.g., 'Leonard''s bicycle'
).
Escape string literals are specified by writing the letter E
(upper or lower case) before the opening single quote, e.g., E'Firebolt 🔥\U0001F680'
.
Use backslash escape sequences within an escape string literal to represent special byte values:
Backslash escape sequence | Interpretation |
---|---|
\b | backspace |
\f | form feed |
\n | newline |
\r | carriage return |
\t | tab |
\o , \oo , \ooo (o = 0–7) | octal byte value (decimal value must be between 1 and 255) |
\xh , \xhh (h = 0–9, A–F) | hexadecimal byte value |
\uxxxx , \Uxxxxxxxx (x = 0–9, A–F) | 16 or 32-bit hexadecimal Unicode character value |
\\
to include one backslash character).
The byte sequences you create must be valid UTF-8.
For historic reasons, if you set the setting standard_conforming_strings
to false
, regular string literals will also recognize backslash escape sequences.
From \ To | UNKNOWN | INT | BIGINT | REAL | DOUBLE | TEXT | BYTEA | BOOLEAN | NUMERIC | ARRAY | DATE | TIMESTAMP | TIMESTAMPTZ | GEOGRAPHY |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
UNKNOWN | Implicit | Implicit | Implicit | Implicit | Implicit | Implicit | Implicit | Implicit | Implicit | Implicit | Implicit | Implicit | Implicit | |
INT | Implicit | Implicit | Implicit | Assignm. | Explicit | Implicit | ||||||||
BIGINT | Assignm. | Assignm. | Implicit | Assignm. | Explicit | Implicit | ||||||||
REAL | Assignm. | Assignm. | Implicit | Assignm. | Explicit | Assignm. | ||||||||
DOUBLE | Assignm. | Assignm. | Assignm. | Assignm. | Explicit | Assignm. | ||||||||
TEXT | Assignm. | Assignm. | Assignm. | Assignm. | Explicit | Explicit | Explicit | Assignm. | Assignm. | Assignm. | Assignm. | Assignm. | ||
BYTEA | Explicit | Implicit | ||||||||||||
BOOLEAN | Explicit | Assignm. | ||||||||||||
NUMERIC | Assignm. | Assignm. | Explicit | Implicit | Assignm. | Explicit | ||||||||
DATE | Assignm. | Implicit | Implicit | |||||||||||
TIMESTAMP | Assignm. | Implicit | Implicit | |||||||||||
TIMESTAMPTZ | Assignm. | Implicit | Implicit | |||||||||||
GEOGRAPHY | Assignm. | Implicit |