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
| Parameter | Type | Required | Description |
|---|---|---|---|
type | TYPE | No | Type of the NULL value, such as BIGINT compile-time |
Notes
- A typed NULL lets type inference work where a bare
NULLhas no type:COALESCE,CASEbranches, 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 BIGINT | f2 BOOLEAN |
|---|---|
| 7 | true |
Default type when omitted
FeatureQL
RETURN
-- NULL() without a type is an unspecified NULL in FeatureQL typing
f1 := TYPEOF(NULL())
;Result
| f1 VARCHAR |
|---|
| UNSPECIFIED |