Data types

ScopeQL values have a data type that determines which operations accept them. Use these type names in column definitions, casts, and function arguments.

List of data types

TypeDescription
intSigned 64-bit integer, from -9223372036854775808 to 9223372036854775807.
uintUnsigned 64-bit integer, from 0 to 18446744073709551615.
float64-bit floating-point number, including infinities and NaN.
stringUTF-8 text.
binarySequence of bytes.
booleanTRUE or FALSE.
timestampInstant in time, expressed as signed 64-bit nanoseconds from the Unix epoch.
intervalDuration expressed as signed 64-bit nanoseconds.
arrayOrdered sequence of values, which may have different types.
objectString keys mapped to values, which may have different types.
anyA value of any supported type, including an array or object.

float comparisons use a total order: NaN equals itself and is greater than every other non-NULL float value. Positive and negative zero compare equal. See comparison operators.

NULL values

NULL represents a missing value. Use IS NULL or IS NOT NULL to test for it; value = NULL returns NULL, not a boolean answer.

Use a typed NULL when the intended type is otherwise ambiguous, for example NULL::string or NULL::array. This matters in VALUES, where the first row determines each column's type. Here the first checkout event has no campaign, but later events supply a string:

VALUES ('evt-17', NULL::string), ('evt-42', 'spring')
SELECT $0 AS event_id, $1 AS campaign
+----------+----------+
| event_id | campaign |
+----------+----------+
| evt-17   | NULL     |
| evt-42   | spring   |
+----------+----------+