📄️ Data Types
General-Purpose Data Types
📄️ Array Type
An ARRAY column stores fixed-sized arrays. All fields in the column must have the same length and the same underlying type. Arrays are typically used to store arrays of numbers, but can contain any uniform data type, including ARRAY, LIST and STRUCT types.
📄️ Bitstring Type
| Name | Aliases | Description |
📄️ Blob Type
| Name | Aliases | Description |
📄️ Boolean Type
| Name | Aliases | Description |
📄️ Date Types
| Name | Aliases | Description |
📄️ Enum Data Type
| Name | Description |
📄️ Interval Type
INTERVALs represent periods of time that can be added to or subtracted from DATE, TIMESTAMP, TIMESTAMPTZ, or TIME values.
📄️ List Type
A LIST column encodes lists of values. Fields in the column can have values with different lengths, but they must all have the same underlying type. LISTs are typically used to store arrays of numbers, but can contain any uniform data type, including other LISTs and STRUCTs.
📄️ Literal Types
Goose has special literal types for representing NULL, integer and string literals in queries. These have their own binding and conversion rules.
📄️ Map Type
MAPs are similar to STRUCTs in that they are an ordered list of key-value pairs. However, MAPs do not need to have the same keys present for each row, and thus are suitable for use cases where the schema is unknown beforehand or varies per row.
📄️ NULL Values
NULL values are special values that are used to represent missing data in SQL. Columns of any type can contain NULL values. Logically, a NULL value can be seen as “the value of this field is unknown”.
📄️ Numeric Types
Fixed-Width Integer Types
📄️ Struct Data Type
Conceptually, a STRUCT column contains an ordered list of columns called “entries”. The entries are referenced by name using strings. This document refers to those entry names as keys. Each row in the STRUCT column must have the same keys. The names of the struct entries are part of the schema. Each row in a STRUCT column must have the same layout. The names of the struct entries are case-insensitive.
📄️ Text Types
In Goose, strings can be stored in the VARCHAR field.
📄️ Time Types
The TIME and TIMETZ types specify the hour, minute, second, microsecond of a day.
📄️ Timestamp Types
Timestamps represent points in time. As such, they combine DATE and TIME information.
📄️ Time Zone Reference List
An up-to-date version of this list can be pulled from the pgtimezonenames() table function:
📄️ Typecasting
Typecasting is an operation that converts a value in one particular data type to the closest corresponding value in another data type.
📄️ Union Type
A UNION type (not to be confused with the SQL UNION operator) is a nested type capable of holding one of multiple “alternative” values, much like the union in C. The main difference being that these UNION types are tagged unions and thus always carry a discriminator “tag” which signals which alternative it is currently holding, even if the inner value itself is null. UNION types are thus more similar to C++17's std::variant, Rust's Enum or the “sum type” present in most functional languages.