classArithmetic
final class Arithmetic
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§
Types the arithmetic operators over numbers, and the interval scaling by a number.
Returns
Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Arithmetic::bitwise() packages/sql-semantics-postgres/src/Rules/Expression/Typing/Arithmetic.php:100
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\OperatorTyping::catalog() packages/sql-semantics-postgres/src/Rules/Expression/Typing/OperatorTyping.php:191
Calls 10
- new Categories line 39
- class-const Builtin::Interval() line 40
- method-call Arithmetic::scaling() line 41
- method-call Categories::numeric() line 43
- function-call
in_arrayline 43 - class-const Arithmetic::INTEGERS() line 46
- class-const Builtin::Float4() line 47
- class-const Builtin::Float8() line 47
- class-const Builtin::Numeric() line 49
- function-call
array_searchline 52
Types the scaling of an interval by a number: interval * n, n * interval, interval / n.
Returns
Test cases 1
Called from 1
Calls 3
- new Categories line 69
- class-const Builtin::Interval() line 70
- method-call Categories::numeric() line 70
Types || with a string on one side: text.
Returns
Test cases 1
Called from 1
Calls 3
- new Categories line 80
- method-call Categories::textual() line 85
- class-const Builtin::Text() line 85
Types the bitwise operators over integers: the type of the left operand for shifts, the wider type otherwise.
Returns
Test cases 1
Called from 1
Calls 4
- function-call
in_arrayline 93 - class-const Arithmetic::INTEGERS() line 93
- class-const Builtin::Int8() line 97
- method-call Arithmetic::arithmetic() line 100
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 1
Method calls 3
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\OperatorTyping::catalog() packages/sql-semantics-postgres/src/Rules/Expression/Typing/OperatorTyping.php:191
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\OperatorTyping::catalog() packages/sql-semantics-postgres/src/Rules/Expression/Typing/OperatorTyping.php:191
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\OperatorTyping::catalog() packages/sql-semantics-postgres/src/Rules/Expression/Typing/OperatorTyping.php:191
Constant reads 2
- class-const SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\PrefixTyping::unary() packages/sql-semantics-postgres/src/Rules/Expression/Typing/PrefixTyping.php:87
- class-const SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\PrefixTyping::unary() packages/sql-semantics-postgres/src/Rules/Expression/Typing/PrefixTyping.php:90