classPredicateTyping
final class PredicateTyping
Types the pattern matches and the time zone conversions.
Rule: PG-PREDICATE-TYPING-001. LIKE is the operator ~~, ILIKE ~~* and SIMILAR TO the regular expression match ~ of the escaped pattern; two string operands match as text (LIKE also as character and name against text), and bytea matches bytea with LIKE; the result is typed by PG-OPERATOR-TYPING-001. AT TIME ZONE and AT LOCAL call timezone: timestamp with time zone, a date and an unknown-typed constant (read as the preferred timestamp with time zone) give timestamp, timestamp gives timestamp with time zone, a time gives time with time zone; the zone is a string or an interval. Termination: constant work. Source: https://www.postgresql.org/docs/17/functions-matching.html, https://www.postgresql.org/docs/17/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT. Status: Implemented.
Methods§
public function pattern(
AnalysisContext $context,
PatternOperator $operator,
TypeFact $left,
TypeFact $right,
): TypeFactTypes a pattern match: boolean for strings, and for bytea with LIKE.
Parameters
$context | AnalysisContext | |
$operator | PatternOperator | |
$left | TypeFact | |
$right | TypeFact |
Returns
Test cases 1
Called from 1
Calls 12
- class-const PatternOperator::Like() line 43
- class-const PatternOperator::ILike() line 44
- class-const PatternOperator::SimilarTo() line 45
- method-call PredicateTyping::string() line 47
- new Known line 50
- class-const Builtin::Bpchar() line 50
- class-const Builtin::Name() line 50
- class-const Builtin::Text() line 50
- method-call OperatorTyping::named() line 54
- new OperatorTyping line 54
- new OperatorName line 54
- new Name line 54
public function zone(AnalysisContext $context, TypeFact $value, TypeFact $zone): TypeFactTypes a time zone conversion of a value by a zone.
Parameters
$context | AnalysisContext | |
$value | TypeFact | |
$zone | TypeFact |
Returns
Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\AtLocal::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Operator/AtLocal.php:52
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\AtTimeZone::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Operator/AtTimeZone.php:58
Calls 14
- new Categories line 67
- method-call Categories::builtin() line 68
- class-const Builtin::Unknown() line 70
- class-const Builtin::Interval() line 70
- method-call Categories::textual() line 70
- class-const Builtin::Timestamptz() line 72
- class-const Builtin::Date() line 72
- class-const Builtin::Timestamp() line 72
- class-const Builtin::Time() line 74
- class-const Builtin::Timetz() line 74
- method-call OperatorTyping::visible() line 78
- new OperatorTyping line 78
- method-call OperatorTyping::undeclared() line 78
- new Known line 78
Answers the string type an operand matches as, unknown-typed constants and varchar as text; null for a type that is not a string.
Parameters
$operand | TypeFact |
Returns
Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\PredicateTyping::pattern() packages/sql-semantics-postgres/src/Rules/Expression/Typing/PredicateTyping.php:47
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\PredicateTyping::pattern() packages/sql-semantics-postgres/src/Rules/Expression/Typing/PredicateTyping.php:48
Calls 6
- new Categories line 86
- method-call Categories::builtin() line 87
- class-const Builtin::Unknown() line 88
- class-const Builtin::Varchar() line 88
- class-const Builtin::Text() line 89
- method-call Categories::textual() line 92
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\AtLocal::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Operator/AtLocal.php:52
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\AtTimeZone::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Operator/AtTimeZone.php:58
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\PatternMatch::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Operator/PatternMatch.php:72
Method calls 3
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\AtLocal::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Operator/AtLocal.php:52
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\AtTimeZone::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Operator/AtTimeZone.php:58
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\Operator\PatternMatch::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/Operator/PatternMatch.php:72