classAssignmentCasts
final class AssignmentCasts
Checks that a value assigned to a column converts to the column's type in assignment context.
Rule: PG-ASSIGNMENT-CAST-001. A value converts when its type is the column type, converts implicitly (PG-TYPE-CATEGORY-001), when both are numeric types, when the column is of a string type (automatic I/O conversion to string types is an assignment cast), or along one of the listed pg_cast entries of context a. A string constant or NULL (pseudo-type unknown) converts to any type. Only a pair of types that both belong to the covered catalog types and that none of these allow is reported; any other pair (domains, arrays, user types, money, oid, xml, a value whose type depends on missing declarations) is accepted. Termination: constant work. Source: https://www.postgresql.org/docs/17/typeconv-query.html, https://www.postgresql.org/docs/17/sql-createcast.html, https://www.postgresql.org/docs/17/catalog-pg-cast.html. Status: Implemented.
Methods§
Tells whether a value of one catalog type is certainly not assignable to a column of another.
Returns
boolTest cases 2
Called from 1
Calls 7
- new Categories line 62
- function-call
in_arrayline 63 - class-const AssignmentCasts::COVERED() line 63
- method-call Categories::implicit() line 67
- method-call Categories::numeric() line 68
- method-call Categories::textual() line 69
- class-const AssignmentCasts::ASSIGNMENT() line 70
public function check(OutputSlot $column, TypeFact $value, Derivation $derivation): voidReports a value that the column it is assigned to cannot take.
Parameters
$column | OutputSlot | |
$value | TypeFact | |
$derivation | Derivation |
Called from 1
Calls 7
- new Categories line 78
- method-call Categories::builtin() line 79
- class-const Builtin::Unknown() line 81
- method-call AssignmentCasts::refused() line 81
- method-call Derivation::report() line 84
- new ManipulationMisuse line 84
- class-const ManipulationMisuseRule::AssignmentType() line 84
Private surface 2§
Implementation details, listed for orientation only.
private const COVERED = ['int2', 'int4', 'int8', 'numeric', 'float4', 'float8', 'bool', 'text', 'varcha…private const ASSIGNMENT = ['timestamp' => ['date', 'time'], 'timestamptz' => ['date', 'time', 'timestamp'…Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.