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 NULL is TRUE (they are the same)
  • value DISPLAYS AS NULL is FALSE when value is not NULL
  • NULL DISPLAYS AS value is 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 FROM is 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 BOOLEANf2 BOOLEAN
truefalse

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 BOOLEANf2 BOOLEANf3 BOOLEAN
truefalsefalse

Other types

FeatureQL
SELECT
    f1 := 1E0 DISPLAYS AS 1E0, -- Same doubles
    f2 := NULL::DOUBLE DISPLAYS AS NULL::DOUBLE -- Both NULL doubles
;
Result
f1 BOOLEANf2 BOOLEAN
truetrue

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 BOOLEANf2 BOOLEAN
truetrue

Last update at: 2026/05/26 17:22:09