classDeclaredTyping
final class DeclaredTyping
Answers what an expression knows about a value of a declared type.
Rule: PG-DECLARED-TYPE-001. Scope: every position that reads a declared column. A column declared with a catalog type has that type. A column declared with a type known by name only (NamedOnPath), or an array over one, has a type the context cannot identify: operators, functions and coercions over it depend on the missing inputs the descriptor carries; so does a column a query defines with a type those inputs settle (Undetermined). Minimum precision: Known for every other descriptor. A column defined by a query (CREATE TABLE AS, SELECT INTO, CREATE VIEW) has the type of its output expression; an output of type unknown (an untyped string constant or NULL) is resolved to text (resolveTargetListUnknowns), and an output whose type depends on missing inputs is Undetermined over them. An output of an invalid type has no column type: the server rejects the statement. Source: https://www.postgresql.org/docs/17/ddl-schemas.html#DDL-SCHEMAS-PATH, https://www.postgresql.org/docs/17/typeconv-select.html. Termination: one step per array level. Status: Implemented.
Methods§
public function fact(TypeDescriptor $type): TypeFactAnswers the type fact of a value of a declared type.
Parameters
$type | TypeDescriptor |
Returns
Test cases 3
Called from 9
- method-call SqlSemantics\Platform\PostgreSql\Rules\Access\GrantedRelations::derive() packages/sql-semantics-postgres/src/Rules/Access/GrantedRelations.php:58
- method-call SqlSemantics\Platform\PostgreSql\Rules\Catalog\PublishedTables::derive() packages/sql-semantics-postgres/src/Rules/Catalog/PublishedTables.php:54
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::input() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:67
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::implicit() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:97
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\RelationTargets::record() packages/sql-semantics-postgres/src/Rules/Routine/RelationTargets.php:105
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::widened() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:128
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Targets::shape() packages/sql-semantics-postgres/src/Rules/Table/Targets.php:87
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Targets::implicit() packages/sql-semantics-postgres/src/Rules/Table/Targets.php:103
- method-call SqlSemantics\Platform\PostgreSql\Rules\Typing\TypeLookup::member() packages/sql-semantics-postgres/src/Rules/Typing/TypeLookup.php:116
public function defined(TypeFact $fact): ?TypeDescriptorAnswers the type a query output of the given fact gives the column it defines, or null when the output has no type.
Parameters
$fact | TypeFact |
Returns
Test cases 3
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryRoots::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryRoots.php:90
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\QueryTables::table() packages/sql-semantics-postgres/src/Rules/Table/Definition/QueryTables.php:77
Calls 3
- class-const Builtin::Unknown() line 60
- class-const Builtin::Text() line 60
- new Undetermined line 62
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
DeclaredTypingTest::testDefinedHasNoTypeForAnInvalidOutputcallsDeclaredTypingTest::testDefinedKeepsTheMissingInputsOfADependentOutputcallsDeclaredTypingTest::testDefinedResolvesUnknownAndNullToTextcallsDeclaredTypingTest::testFactDependsOnTheMissingInputsOfAnUndeterminedTypecallsDeclaredTypingTest::testFactDependsOnTheMissingInputsOfATypeKnownByNameOnlycallsDeclaredTypingTest::testFactKnowsACatalogTypecalls
Relations§
Instantiated in 11
- new SqlSemantics\Platform\PostgreSql\Rules\Access\GrantedRelations::derive() packages/sql-semantics-postgres/src/Rules/Access/GrantedRelations.php:58
- new SqlSemantics\Platform\PostgreSql\Rules\Catalog\PublishedTables::derive() packages/sql-semantics-postgres/src/Rules/Catalog/PublishedTables.php:54
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryRoots::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryRoots.php:88
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::input() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:67
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::implicit() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:97
- new SqlSemantics\Platform\PostgreSql\Rules\Routine\RelationTargets::record() packages/sql-semantics-postgres/src/Rules/Routine/RelationTargets.php:105
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::widened() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:128
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\QueryTables::table() packages/sql-semantics-postgres/src/Rules/Table/Definition/QueryTables.php:74
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Targets::shape() packages/sql-semantics-postgres/src/Rules/Table/Targets.php:87
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Targets::implicit() packages/sql-semantics-postgres/src/Rules/Table/Targets.php:103
- new SqlSemantics\Platform\PostgreSql\Rules\Typing\TypeLookup::member() packages/sql-semantics-postgres/src/Rules/Typing/TypeLookup.php:116
Method calls 11
- method-call SqlSemantics\Platform\PostgreSql\Rules\Access\GrantedRelations::derive() packages/sql-semantics-postgres/src/Rules/Access/GrantedRelations.php:58
- method-call SqlSemantics\Platform\PostgreSql\Rules\Catalog\PublishedTables::derive() packages/sql-semantics-postgres/src/Rules/Catalog/PublishedTables.php:54
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryRoots::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryRoots.php:90
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::input() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:67
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::implicit() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:97
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\RelationTargets::record() packages/sql-semantics-postgres/src/Rules/Routine/RelationTargets.php:105
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::widened() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:128
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\QueryTables::table() packages/sql-semantics-postgres/src/Rules/Table/Definition/QueryTables.php:77
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Targets::shape() packages/sql-semantics-postgres/src/Rules/Table/Targets.php:87
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Targets::implicit() packages/sql-semantics-postgres/src/Rules/Table/Targets.php:103
- method-call SqlSemantics\Platform\PostgreSql\Rules\Typing\TypeLookup::member() packages/sql-semantics-postgres/src/Rules/Typing/TypeLookup.php:116