EQUALS()

All functions > COMPARISON > EQUALS()

Returns TRUE if the first value equals the second value

Signatures

Returns: TRUE or FALSE according to the comparison, or NULL if either operand is NULL

EQUALS(expr1: T, expr2: T, [digits: BIGINT]) → BOOLEAN
sql
ParameterTypeRequiredDescription
expr1TYesFirst value to compare
expr2TYesSecond value to compare
digitsBIGINTNoDigits of rounded FLOAT/DOUBLE precision (.N); not applied when Inf or magnitude overflows DECIMAL(38, N) staging

Notes

  • Both values must be of the same or compatible types
  • NULL comparisons always return NULL (three-valued logic)
  • For strings, performs case-sensitive exact match
  • On FLOAT/DOUBLE, write .N (e.g. >.2, =.4, BETWEEN.3) for N digits of rounded precision via DECIMAL(38, N) staging
  • Any NaN operand makes the comparison NULL
  • Infinity, or any finite value too large for DECIMAL(38, N), falls back to a raw float compare — .N rounding is not applied on that path
  • For dates/timestamps, compares exact date and time values
  • For ARRAY and ROW, compares element- or field-by-element when types align
  • Nested NULL in either ARRAY/ROW operand makes EQUALS NULL; use DISPLAYS_AS for null-safe equality

Related operators

Examples

EQUALS — functional call

FeatureQL
SELECT
    -- `EQUALS(expr1, expr2)` matches infix `=`
    f1 := EQUALS(42, 42),
    -- Unequal scalars
    f2 := EQUALS(1, 2),
    -- Nested NULL poisons equality
    f3 := EQUALS(ROW(1::BIGINT, NULL::BIGINT), ROW(1::BIGINT, NULL::BIGINT))
;
Result
f1 BOOLEANf2 BOOLEANf3 BOOLEAN
truefalseNULL

EQUALS — chained

FeatureQL
SELECT
    -- Dot form: receiver is the left-hand operand
    f1 := (42).EQUALS(42),
    -- Same semantics as the prefix call
    f2 := (1).EQUALS(2)
;
Result
f1 BOOLEANf2 BOOLEAN
truefalse