Skip to main content
Two extension traits add DuckDB’s operators that stock Diesel lacks. Both are blanket-implemented for every expression and come in through the DSL prelude:

Text matching — DuckTextExpressionMethods

The right-hand side binds as Text. These are DuckDB’s string-matching operators:
.regexp_matches() (an operator method producing the ~ operator) and the free function regexp_matches(s, pat) (which emits the regexp_matches(...) call — see String functions) are distinct items that happen to share a name. Pick the method for operator-style predicates, the function to call the SQL function.

Null-safe comparison — DuckExpressionMethods

Unlike =/<>, these never yield NULL: NULL IS NOT DISTINCT FROM NULL is true, and 1 IS DISTINCT FROM NULL is true. Use them when either side can be NULL and you want set-style equality.

See also

String functions

Function forms of regex and matching.

Select

Where predicates are used.

DSL overview

The prelude and the rest of the DSL.

Delete

Operators in a delete filter.