IS NULL
All functions > COMPARISON > IS NULL
Returns TRUE if the expression evaluates to NULL.
Syntax
expr IS NULL [:: type]
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
Related Functions
Examples
IS NULL — detection
FeatureQL
SELECT
f1 := NULL::BIGINT IS NULL::BIGINT, -- Typed NULL
f2 := 1 IS NULL::BIGINT -- Non-NULL literal
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
IS NULL — composite values
FeatureQL
SELECT
f1 := NULL::ARRAY(BIGINT) IS NULL::ARRAY(BIGINT), -- Typed NULL array
f2 := ARRAY(1, 2) IS NULL::ARRAY(BIGINT) -- Non-NULL array
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
IS NULL — contrast with =
FeatureQL
SELECT
f1 := NULL::BIGINT = NULL::BIGINT -- `=` cannot test NULL equality
;Result
| f1 BOOLEAN |
|---|
| NULL |