IS NULL
All functions > COMPARISON > IS NULL
Returns TRUE if the expression evaluates to NULL.
Syntax
expr IS NULL [:: type]
Function form
Returns: TRUE or FALSE; these predicates do not return NULL themselves
IS_NULL(expr: T) → BOOLEAN sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr | T | Yes | Expression that may be NULL |
Notes
- Only reliable way to test for NULL values
- Using
= NULLor!= NULLalways returns NULL, not TRUE/FALSE - Works with any data type; optional
::Tafter the keywords disambiguates the expression when its type would otherwise be unclear (for exampleEMPTYfrom an unmatchedRELATED); when::Tis present it must match the expression type (including ARRAY and ROW) - Never returns NULL itself - always Returns TRUE or FALSE
Examples
IS NULL — detection
FeatureQL
RETURN
-- Typed NULL
f1 := NULL::BIGINT IS NULL::BIGINT,
-- Non-NULL literal
f2 := 1 IS NULL::BIGINT
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
IS NULL — composite values
FeatureQL
RETURN
-- Typed NULL array
f1 := NULL::ARRAY<BIGINT> IS NULL::ARRAY<BIGINT>,
-- Non-NULL array
f2 := ARRAY(1, 2) IS NULL::ARRAY<BIGINT>
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
IS NULL — contrast with =
FeatureQL
RETURN
-- `=` cannot test NULL equality
f1 := NULL::BIGINT = NULL::BIGINT
;Result
| f1 BOOLEAN |
|---|
| NULL |
IS_NULL — functional call (second arg is TYPE '…', not a bare type name)
FeatureQL
RETURN
-- `TYPE 'T'` supplies the predicate type; it must match the expression type
f1 := IS_NULL(NULL::BIGINT, TYPE 'BIGINT'),
-- Non-NULL value
f2 := IS_NULL(1::BIGINT, TYPE 'BIGINT')
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
IS_NULL — chained
FeatureQL
RETURN
-- Dot form: receiver is the expression under test
f1 := (NULL::BIGINT).IS_NULL(TYPE 'BIGINT'),
-- Same semantics as the prefix call
f2 := (1::BIGINT).IS_NULL(TYPE 'BIGINT')
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |