DISPLAYS AS
All functions > COMPARISON > DISPLAYS AS
Returns TRUE if two values are not distinct, treating NULL values as comparable.
Syntax
expr1 DISPLAYS AS expr2 · expr1 IS NOT DISTINCT FROM expr2
Notes
- Unlike
=, NULL is treated as comparable here (null-safe equality) NULL DISPLAYS AS NULLis TRUE (they are the same)value DISPLAYS AS NULLis FALSE when value is not NULL- Nested NULL inside ARRAY/ROW is compared null-safely at every nesting level
- Both values must be of the same type (including matching ARRAY/ROW structure and field/element types)
- Opposite of NOT DISPLAYS AS
- SQL spelling
IS NOT DISTINCT FROMis a separate operator/function pair (same semantics, preserves formatting) - Prefer this over
=for null-safe joins and filters;GROUP BYalready uses DISPLAYS AS equivalence
Related Functions
See also
Examples
DISPLAYS AS
FeatureQL
SELECT
-- Same values
f1 := 1 DISPLAYS AS 1,
-- Different values
f2 := 1 DISPLAYS AS 2
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
NULL handling
FeatureQL
SELECT
-- Both NULL
f1 := NULL::BIGINT DISPLAYS AS NULL::BIGINT,
-- NULL vs non-NULL
f2 := NULL::BIGINT DISPLAYS AS 1,
-- Non-NULL vs NULL
f3 := 1 DISPLAYS AS NULL::BIGINT
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | false | false |
Other types
FeatureQL
SELECT
-- Same doubles
f1 := 1e0 DISPLAYS AS 1e0,
-- Both NULL doubles
f2 := NULL::DOUBLE DISPLAYS AS NULL::DOUBLE
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | true |
DISPLAYS AS — arrays and rows
FeatureQL
SELECT
-- Equal rows
f1 := ROW(1 AS a) DISPLAYS AS ROW(1 AS a),
-- Both NULL arrays
f2 := NULL::ARRAY(BIGINT) DISPLAYS AS NULL::ARRAY(BIGINT),
-- Nested NULL fields match (contrast with `=` → NULL)
f3 := ROW(1::BIGINT, NULL::BIGINT) DISPLAYS AS ROW(1::BIGINT, NULL::BIGINT)
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | true | true |