The MSQL query language supports a wide range of both common and special-purpose SQL data types.
MSQL data types are organized into categories and families according to the following layout:
true
/false
values.(start timepoint, end timepoint)
point
, line
, polygon
).mpoint
, mline
, mpolygon
).gpoint
, gline
, gpolygon
).gmpoint
, gmline
, gmpolygon
).The following is a list of all the supported types in each category:
Scalar | Range | String-like | Spatial |
---|---|---|---|
Booleans | Numeric ranges | Textual strings | Single geometries |
bool |
i8range |
str |
point |
Numerics | i16range |
symbol |
line |
i8 |
i32range |
Binary strings | polygon |
i16 |
i64range |
bstr |
Geometry collections |
i32 |
u8range |
bsymbol |
mpoint |
i64 |
u16range |
mline |
|
u8 |
u32range |
mpolygon |
|
u16 |
u64range |
Single geographies | |
u32 |
f32range |
gpoint |
|
u64 |
f64range |
gline |
|
f32 |
Temporal ranges | gpolygon |
|
f64 |
tsrange |
Geography collections | |
Timepoints | epochrange |
gmpoint |
|
ts |
gmline |
||
epoch |
gmpolygon |
||
Timeperiods | |||
tp |
Almost every type has one or more aliases, i.e. other names by which they can be referred to.
For example, for the bool type, names boolean
and bit
are also allowed.
The full list of available type aliases can be found in a separate section Type aliases.
Unlike many other SQL dialects, MSQL is very strict about data types. It doesn't allow implicit casts to/from different type categories (e.g. string <-> numeric
, string <-> timepoint
).
Only the implicit cast to a supertype is generally allowed, e.g. i16 -> i64
or i32 -> f64
, with casting rules similar to those of the C programming language.
For other needs, type casts (when allowed) must be explicitly stated using either the CAST function (CAST(x AS type)
), or using the :: operator (x::type
, the recommended way).
At the end of this section is a table listing all the available type conversions.