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 DISPLAYS AS NULLis TRUE (they are the same)value DISPLAYS AS NULLis FALSE when value is not NULLNULL DISPLAYS AS valueis FALSE when value is not NULL- 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)
Related Functions
See also
Examples
DISPLAYS AS
FeatureQL
SELECT
f1 := 1 DISPLAYS AS 1, -- Same values
f2 := 1 DISPLAYS AS 2 -- Different values
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |
NULL handling
FeatureQL
SELECT
f1 := NULL::BIGINT DISPLAYS AS NULL::BIGINT, -- Both NULL
f2 := NULL::BIGINT DISPLAYS AS 1, -- NULL vs non-NULL
f3 := 1 DISPLAYS AS NULL::BIGINT -- Non-NULL vs NULL
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | false | false |
Other types
FeatureQL
SELECT
f1 := 1E0 DISPLAYS AS 1E0, -- Same doubles
f2 := NULL::DOUBLE DISPLAYS AS NULL::DOUBLE -- Both NULL doubles
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | true |
DISPLAYS AS — arrays and rows
FeatureQL
SELECT
f1 := ROW(1 AS a) DISPLAYS AS ROW(1 AS a), -- Equal rows
f2 := NULL::ARRAY(BIGINT) DISPLAYS AS NULL::ARRAY(BIGINT) -- Both NULL arrays
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | true |