DISPLAYS_AS
All functions > COMPARISON > DISPLAYS_AS
Returns TRUE if two values are not distinct, treating NULL values as comparable.
Signatures
Returns: TRUE if values are not distinct, FALSE otherwise
DISPLAYS_AS(expr1: T, expr2: T) → BOOLEAN sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr1 | T | Yes | First value to compare |
expr2 | T | Yes | Second value to compare |
Notes
- Unlike regular equality (
=), this function treats NULL values as comparable NULL DISPLAYS_AS NULLReturns TRUE (they are the same)value DISPLAYS_AS NULLReturns FALSE if value is not NULLNULL DISPLAYS_AS valueReturns FALSE if value is not NULL- Both values must be of the same type
- Standard SQL alias: IS_NOT_DISTINCT_FROM
- Opposite of NOT_DISPLAYS_AS function
- Can be used with operator syntax:
value1 IS NOT DISTINCT FROM value2
Aliases
IS_NOT_DISTINCT_FROM
See also
Examples
Basic comparisons
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 |