= [equals]
All functions > COMPARISON > = [equals]
Returns TRUE if the first value equals the second value
Syntax
expr1 = expr2
Function form
Returns: TRUE or FALSE according to the comparison, or NULL if either operand is NULL
EQUALS(expr1: T, expr2: T, [digits: BIGINT]) → BOOLEAN sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr1 | T | Yes | First value to compare |
expr2 | T | Yes | Second value to compare |
digits | BIGINT | No | Digits 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 decimal places of rounded precision viaDECIMAL(38, N)staging, not N significant digits. Omitting.Nuses 15 decimal places (DECIMAL(38, 15)) IN.Nis the same suffix on membership- 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 —.Nrounding 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
=NULL (structural mismatch does not rescue a poisoned pair) - For null-safe equality, use IS NOT DISTINCT FROM
Examples
= — values and strings
FeatureQL
RETURN
-- Numeric equality
f1 := 42 = 42,
-- Exact string match
f2 := 'hello' = 'hello',
-- Case sensitive
f3 := 'Hello' = 'hello'
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | true | false |
= — arrays and rows
FeatureQL
RETURN
-- Element-wise; integer/decimal may align per element
f1 := ARRAY(1, 2, 3) = ARRAY(1., 2., 3.),
-- Field-wise; same rules as scalars on each field
f2 := ROW(1 AS a) = ROW(1. AS a)
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | true |
= — three-valued logic
FeatureQL
RETURN
-- `=` never yields TRUE for NULL = NULL
f1 := NULL::BIGINT = NULL::BIGINT,
-- Non-NULL vs NULL
f2 := 1 = NULL::BIGINT,
-- Nested NULL poisons `=` (use DISPLAYS AS for null-safe)
f3 := ROW(1::BIGINT, NULL::BIGINT) = ROW(1::BIGINT, NULL::BIGINT),
-- Mismatch does not rescue a poisoned pair
f4 := ROW(1::BIGINT, NULL::BIGINT) = ROW(2::BIGINT, 2::BIGINT)
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN | f4 BOOLEAN |
|---|---|---|---|
| NULL | NULL | NULL | NULL |
EQUALS — functional call
FeatureQL
RETURN
-- `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 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | false | NULL |
EQUALS — chained
FeatureQL
RETURN
-- Dot form: receiver is the left-hand operand
f1 := (42).EQUALS(42),
-- Same semantics as the prefix call
f2 := (1).EQUALS(2)
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| true | false |