IS NOT NULL
All functions > COMPARISON > IS NOT NULL
Returns TRUE if the expression does NOT evaluate to NULL.
Syntax
expr IS NOT NULL [:: type]
Notes
- Opposite of IS NULL
- Only reliable way to test for non-NULL values
- Using
!= 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 - Never returns NULL itself - always Returns TRUE or FALSE
Related Functions
Examples
IS NOT NULL — detection
FeatureQL
SELECT
f1 := 'x' IS NOT NULL::VARCHAR, -- Non-NULL string
f2 := NULL::VARCHAR IS NOT NULL::VARCHAR -- NULL is not non-NULL
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
IS NOT NULL — composite values
FeatureQL
SELECT
f1 := ARRAY(1, 2) IS NOT NULL::ARRAY(BIGINT) -- Non-NULL array
;Result
| f1 BOOLEAN |
|---|
| true |
IS NOT NULL — contrast with !=
FeatureQL
SELECT
f1 := NULL::BIGINT != NULL::BIGINT -- `!=` does not behave like IS NOT NULL
;Result
| f1 BOOLEAN |
|---|
| NULL |