final class Arithmetic
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.

Types the arithmetic, concatenation and bitwise catalog operators over base types.

Rule: PG-ARITHMETIC-TYPING-001. + - * / over numbers give the wider of two integer types, numeric with an integer and numeric, double precision once a floating-point type meets another type, and the type itself for two equal types; % is defined for integers and numeric; ^ for double precision and numeric, integers reaching it as double precision; an interval is scaled by a number with * and /; || gives text when a side is a string; the bitwise operators keep the integer type, a shift the type of its left operand. These follow from the catalog operators and the numeric promotion of operator resolution. Termination: constant work. Source: https://www.postgresql.org/docs/17/functions-math.html, https://www.postgresql.org/docs/17/typeconv-oper.html, https://www.postgresql.org/docs/17/functions-string.html. Status: Implemented.

Constants§

public const INTEGERS = [\SqlSemantics\Platform\PostgreSql\Statement\Type\Descriptor\Builtin::Int2, \Sq…

The integer types, narrowest first.

Methods§

public function scaling(string $operator, Builtin $left, Builtin $right): ?Builtin

Types the scaling of an interval by a number: interval * n, n * interval, interval / n.

Parameters

$operatorstring
$leftBuiltin
$rightBuiltin

Returns

Test cases 1
Called from 1
Calls 3
public function concatenation(string $operator, Builtin $left, Builtin $right): ?Builtin
public function bitwise(string $operator, Builtin $left, Builtin $right): ?Builtin

Types the bitwise operators over integers: the type of the left operand for shifts, the wider type otherwise.

Parameters

$operatorstring
$leftBuiltin
$rightBuiltin

Returns

Test cases 1
Called from 1
Calls 4

Test cases 4§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 4

Relations§

Instantiated in 1
Method calls 3
Constant reads 2