- Inside the opaque read (and inside server-side statements) you are writing the engine’s SQL — every function the engine has is available there, and heavyweight transformation (regex, format masks, text parsing) belongs there.
- In compute position — expressions on variables and
recfields — the functions on this page are the supported set. They run in Sumatra’s own evaluator, bit-exact to the engine’s semantics.
Null handling
Operands of
GREATEST, LEAST (and CASE arms) must share a type
family — mixing TEXT with numbers or dates is a compile error asking
for an explicit CAST, rather than a runtime coercion that faults only
on bad data.
Math
Division is the
/ operator; dividing by zero faults with
ZERO_DIVIDE (see numeric semantics
for the width, promotion, and overflow rules).
Text
Two operator companions:
|| concatenates two strings (NULL
propagates), and LIKE (with the usual % and _ wildcards) is the
language’s pattern match.
Date and time
The unit is a quoted string, first argument:
'year', 'month',
'day', 'hour', 'minute', 'second'.
OVERFLOW. Time parts cannot be extracted from a plain DATE.
INTERVAL arithmetic (ts - INTERVAL '24' HOUR) is SQL-side — use it
inside reads and write statements.
Casts and conversions
CAST(x AS T) and the shorthand x::T convert between compute types:
These are the same conversions assignment applies implicitly when the
declared type differs from the value’s type.
