classQueryFact
final class QueryFact
uses Snapshot
Public API: explicitly declared with
@visibility public.What an operation derived for the output of one query.
The projection lists the output fields in order. A star that missing declarations prevent from expanding stays a typed request and leaves the shape open; no field is invented for it.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 AS a, 2 AS b');
[count($query->facts->output->projection), $query->facts->output->shape->complete()] // => [2, true]Properties§
public RowShape $shapepublic Comparison $namesMethods§
public function __construct(array<array-key, object> $projection, public Comparison $names)Parameters
$projection | array<array-key, object> | The output fields and unexpandable stars in order, as a list of Field and OpenStar |
$names | Comparison | How output names are compared |
Throws
InvalidConstruction When the projection holds anything but fields and open starsCalls 5
- function-call
array_pushline 59 - new InvalidConstruction line 61
- static-call Check::input() line 65
- function-call
array_is_listline 65 - new RowShape line 67
public function fields(): ?FieldsAnswers the complete field list, or null while a star cannot be expanded.
Returns
Called from 5
- method-call SqlSemantics\Platform\PostgreSql\Model\Statement\Fact\QueryFact::lookup() packages/sql-semantics-postgres/src/Model/Statement/Fact/QueryFact.php:91
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Sublinks::slots() packages/sql-semantics-postgres/src/Rules/Expression/Typing/Sublinks.php:137
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::combined() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:66
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::combined() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:67
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::rebound() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:101
public function lookup(string $name): FieldLookupLooks an output field up by name without choosing among several or guessing in an open shape.
Parameters
$name | string |
Returns
Calls 3
- method-call QueryFact::fields() line 91
- method-call Comparison::equal() line 97
- new DependentField line 102
Test cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Other tests reaching this symbol 11
SublinksTest::testArrayIsAnArrayOfTheColumnTypecallsSublinksTest::testComparedReportsAWrongNumberOfColumnscallsSublinksTest::testSlotsDependOnAnOpenShapecallsSublinksTest::testValueIsARowForSeveralColumnscallsArraySubqueryTest::testDeriveScalarIsAnArrayOfTheColumnTypecallsExistsTest::testDeriveScalarIsANonNullBooleancallsInSubqueryTest::testDeriveScalarComparesWithTheColumncallsQuantifiedSubqueryTest::testDeriveScalarComparesWithTheColumncallsScalarSubqueryTest::testDeriveScalarHasTheColumnTypeAndCanBeNullcallsScalarSubqueryTest::testDeriveScalarReportsAQueryWithoutColumnscallsUniquePredicateTest::testDeriveScalarReportsThePredicatecalls
Relations§
Instantiated in 10
- new SqlSemantics\Platform\PostgreSql\Rules\Manipulation\ModificationScope::returning() packages/sql-semantics-postgres/src/Rules/Manipulation/ModificationScope.php:114
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:98
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:112
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:56
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\ValuesFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/ValuesFacts.php:64
- new SqlSemantics\Platform\PostgreSql\Rules\Utility\ExplainFacts::rows() packages/sql-semantics-postgres/src/Rules/Utility/ExplainFacts.php:75
- new SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Cursor\Fetch::deriveStatement() packages/sql-semantics-postgres/src/Statement/Manipulation/Cursor/Fetch.php:61
- new SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Prepared\Execute::rows() packages/sql-semantics-postgres/src/Statement/Manipulation/Prepared/Execute.php:83
- new SqlSemantics\Platform\PostgreSql\Statement\Utility\Call::deriveStatement() packages/sql-semantics-postgres/src/Statement/Utility/Call.php:56
- new SqlSemantics\Platform\PostgreSql\Statement\Utility\Session\Show::deriveStatement() packages/sql-semantics-postgres/src/Statement/Utility/Session/Show.php:71
Method calls 4
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Sublinks::slots() packages/sql-semantics-postgres/src/Rules/Expression/Typing/Sublinks.php:137
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::combined() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:66
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::combined() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:67
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::rebound() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:101
Type declarations 42
- type SqlSemantics\Platform\PostgreSql\Model\Construction\Derivation packages/sql-semantics-postgres/src/Model/Construction/Derivation.php:62
- type SqlSemantics\Platform\PostgreSql\Model\Construction\Derivation packages/sql-semantics-postgres/src/Model/Construction/Derivation.php:203
- type SqlSemantics\Platform\PostgreSql\Model\Construction\Derivation packages/sql-semantics-postgres/src/Model/Construction/Derivation.php:237
- type SqlSemantics\Platform\PostgreSql\Model\Statement\Fact\Facts packages/sql-semantics-postgres/src/Model/Statement/Fact/Facts.php:62
- type SqlSemantics\Platform\PostgreSql\Model\Statement\Fact\Facts packages/sql-semantics-postgres/src/Model/Statement/Fact/Facts.php:116
- type SqlSemantics\Platform\PostgreSql\Model\Statement\Query packages/sql-semantics-postgres/src/Model/Statement/Query.php:27
- type SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Sublinks packages/sql-semantics-postgres/src/Rules/Expression/Typing/Sublinks.php:48
- type SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Sublinks packages/sql-semantics-postgres/src/Rules/Expression/Typing/Sublinks.php:64
- type SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Sublinks packages/sql-semantics-postgres/src/Rules/Expression/Typing/Sublinks.php:84
- type SqlSemantics\Platform\PostgreSql\Rules\Expression\Typing\Sublinks packages/sql-semantics-postgres/src/Rules/Expression/Typing/Sublinks.php:135
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\ChangeFacts packages/sql-semantics-postgres/src/Rules/Manipulation/ChangeFacts.php:32
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\ChangeFacts packages/sql-semantics-postgres/src/Rules/Manipulation/ChangeFacts.php:49
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\InsertFacts packages/sql-semantics-postgres/src/Rules/Manipulation/InsertFacts.php:55
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\InsertFacts packages/sql-semantics-postgres/src/Rules/Manipulation/InsertFacts.php:88
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\InsertFacts packages/sql-semantics-postgres/src/Rules/Manipulation/InsertFacts.php:115
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\MergeFacts packages/sql-semantics-postgres/src/Rules/Manipulation/MergeFacts.php:47
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\ModificationScope packages/sql-semantics-postgres/src/Rules/Manipulation/ModificationScope.php:106
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\CommonTableFacts packages/sql-semantics-postgres/src/Rules/Query/Facts/CommonTableFacts.php:176
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:45
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryRoots packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryRoots.php:84
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:58
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:104
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:51
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:64
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:93
- type SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\ValuesFacts packages/sql-semantics-postgres/src/Rules/Query/Facts/ValuesFacts.php:38
- type SqlSemantics\Platform\PostgreSql\Rules\Resolution\ColumnAliases packages/sql-semantics-postgres/src/Rules/Resolution/ColumnAliases.php:61
- type SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\QueryTables packages/sql-semantics-postgres/src/Rules/Table/Definition/QueryTables.php:68
- type SqlSemantics\Platform\PostgreSql\Rules\Utility\ExplainFacts packages/sql-semantics-postgres/src/Rules/Utility/ExplainFacts.php:57
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Delete packages/sql-semantics-postgres/src/Statement/Manipulation/Delete.php:88
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\InsertDefaults packages/sql-semantics-postgres/src/Statement/Manipulation/InsertDefaults.php:87
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\InsertRows packages/sql-semantics-postgres/src/Statement/Manipulation/InsertRows.php:103
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\InsertSelect packages/sql-semantics-postgres/src/Statement/Manipulation/InsertSelect.php:108
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Merge packages/sql-semantics-postgres/src/Statement/Manipulation/Merge.php:100
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Prepared\Execute packages/sql-semantics-postgres/src/Statement/Manipulation/Prepared/Execute.php:81
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Update packages/sql-semantics-postgres/src/Statement/Manipulation/Update.php:102
- type SqlSemantics\Platform\PostgreSql\Statement\Query\ParenthesizedQuery packages/sql-semantics-postgres/src/Statement/Query/ParenthesizedQuery.php:63
- type SqlSemantics\Platform\PostgreSql\Statement\Query\QueryExpression packages/sql-semantics-postgres/src/Statement/Query/QueryExpression.php:78
- type SqlSemantics\Platform\PostgreSql\Statement\Query\Select packages/sql-semantics-postgres/src/Statement/Query/Select.php:133
- type SqlSemantics\Platform\PostgreSql\Statement\Query\SetOperation packages/sql-semantics-postgres/src/Statement/Query/SetOperation.php:83
- type SqlSemantics\Platform\PostgreSql\Statement\Query\TableQuery packages/sql-semantics-postgres/src/Statement/Query/TableQuery.php:79
- type SqlSemantics\Platform\PostgreSql\Statement\Query\ValuesList packages/sql-semantics-postgres/src/Statement/Query/ValuesList.php:69