NULL()

All functions > CORE > NULL()

Returns a NULL value of the given type.

Signatures

Returns: A NULL value of the specified type

NULL( type ) → T

NULL::type → T
sql
ParameterTypeRequiredDescription
typeTYPENoType of the NULL value, such as BIGINT compile-time

Notes

  • A typed NULL lets type inference work where a bare NULL has no type: COALESCE, CASE branches, array elements, UNION-like constructs
  • Without a type, NULL() is untyped (UNSPECIFIED) and becomes a VARCHAR NULL in SQL
  • NULL values propagate through most operations

See also

Examples

Typed NULL

FeatureQL
RETURN
    -- NULL(BIGINT) carries BIGINT so COALESCE can fill in a default
    f1 := COALESCE(NULL::BIGINT, 7),
    -- Explicit typed NULL compares with IS NULL
    f2 := (NULL::BIGINT IS NULL::BIGINT) = TRUE
;
Result
f1 BIGINTf2 BOOLEAN
7true

Default type when omitted

FeatureQL
RETURN
    -- NULL() without a type is an unspecified NULL in FeatureQL typing
    f1 := TYPEOF(NULL())
;
Result
f1 VARCHAR
UNSPECIFIED