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 NULL is TRUE (they are the same)
  • value DISPLAYS AS NULL is 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
  • Permissive spelling. Canonical null-safe equality is IS NOT DISTINCT FROM; FORMAT (FIX) rewrites this operator there
  • Prefer IS NOT DISTINCT FROM over = for null-safe joins and filters; GROUP BY uses the same null-safe equivalence

Related Functions

See also

Examples

DISPLAYS AS

FeatureQL
RETURN
    -- Same values
    f1 := 1 IS NOT DISTINCT FROM 1,
    -- Different values
    f2 := 1 IS NOT DISTINCT FROM 2
;
Result
f1 BOOLEANf2 BOOLEAN
truefalse

NULL handling

FeatureQL
RETURN
    -- Both NULL
    f1 := NULL::BIGINT IS NOT DISTINCT FROM NULL::BIGINT,
    -- NULL vs non-NULL
    f2 := NULL::BIGINT IS NOT DISTINCT FROM 1,
    -- Non-NULL vs NULL
    f3 := 1 IS NOT DISTINCT FROM NULL::BIGINT
;
Result
f1 BOOLEANf2 BOOLEANf3 BOOLEAN
truefalsefalse

Other types

FeatureQL
RETURN
    -- Same doubles
    f1 := 1e0 IS NOT DISTINCT FROM 1e0,
    -- Both NULL doubles
    f2 := NULL::DOUBLE IS NOT DISTINCT FROM NULL::DOUBLE
;
Result
f1 BOOLEANf2 BOOLEAN
truetrue

DISPLAYS AS — arrays and rows

FeatureQL
RETURN
    -- Equal rows
    f1 := ROW(1 AS a) IS NOT DISTINCT FROM ROW(1 AS a),
    -- Both NULL arrays
    f2 := NULL::ARRAY<BIGINT> IS NOT DISTINCT FROM NULL::ARRAY<BIGINT>,
    -- Nested NULL fields match (contrast with `=` → NULL)
    f3 := ROW(1::BIGINT, NULL::BIGINT)
    IS NOT DISTINCT FROM ROW(1::BIGINT, NULL::BIGINT)
;
Result
f1 BOOLEANf2 BOOLEANf3 BOOLEAN
truetruetrue