Functions for Working with ULID
generateULID
Generates the ULID.
Syntax
Arguments
x— Expression resulting in any of the supported data types. The resulting value is discarded, but the expression itself if used for bypassing common subexpression elimination if the function is called multiple times in one query. Optional parameter.
Returned value
The FixedString type value.
Usage example
Usage example if it is needed to generate multiple values in one row
ULIDStringToDateTime
This function extracts the timestamp from a ULID.
Syntax
Arguments
ulid— Input ULID. String or FixedString(26).timezone— Timezone name for the returned value (optional). String.
Returned value
- Timestamp with milliseconds precision. DateTime64(3).
Usage example
See Also
ULIDStringToDateTime
Introduced in: v23.3
This function extracts the timestamp from a [ULID]((https://github.com/ulid/spec).
Syntax
Arguments
ulid— Input ULID.StringorFixedString(26)timezone— Optional. Timezone name for the returned value.String
Returned value
Timestamp with milliseconds precision. DateTime64(3)
Examples
Usage example
generateULID
Introduced in: v23.2
Generates a Universally Unique Lexicographically Sortable Identifier (ULID).
Syntax
Arguments
x— Optional. An expression resulting in any of the supported data types. The resulting value is discarded, but the expression itself if used for bypassing common subexpression elimination if the function is called multiple times in one query.Any
Returned value
Returns a ULID. FixedString(26)
Examples
Usage example
Usage example if it is needed to generate multiple values in one row