classQueryExpressionFacts
final class QueryExpressionFacts
Derives the facts of a query expression: its WITH clause, its body and the clauses after it.
Rule: PG-QUERY-EXPRESSION-001. The common tables of the WITH clause are visible in the body (PG-COMMON-TABLE-001). The output is that of the body. ORDER BY and locking clauses that belong to a selection or TABLE query inside parentheses are handed to it (PG-QUERY-OPTIONS-001); after a set operation or VALUES, ORDER BY sees only the output fields (PG-ORDERING-001), and locking is reported. LIMIT and OFFSET see only the enclosing queries. PostgreSQL merges the clauses written at different parenthesis levels into one query and reports a second ORDER BY, LIMIT, OFFSET or WITH clause. Terminates: the chain of parentheses is finite. Source: https://www.postgresql.org/docs/17/sql-select.html. Status: Implemented.
Methods§
public function derive(
QueryExpression $query,
Derivation $derivation,
Environment $outer,
): QueryFactDerives every part of the query expression and answers its output.
Parameters
$query | QueryExpression | |
$derivation | Derivation | |
$outer | Environment |
Returns
Called from 1
Calls 15
- new Carriers line 48
- method-call Carriers::core() line 49
- method-call Derivation::query() line 51
- method-call Carriers::carry() line 51
- method-call QueryExpressionFacts::merged() line 52
- method-call Ordering::outputs() line 58
- new Ordering line 58
- function-call
array_mapline 58 - method-call Derivation::report() line 60
- new QueryMisuse line 60
- class-const QueryMisuseRule::LockingWithSetOperation() line 60
- class-const QueryMisuseRule::LockingOnValues() line 60
- method-call Limits::ties() line 62
- new Limits line 62
- method-call Limits::derive() line 64
public function merged(QueryExpression $query, Derivation $derivation): voidReports a clause written both here and at a parenthesis level inside, which PostgreSQL cannot merge.
Parameters
$query | QueryExpression | |
$derivation | Derivation |
Called from 1
Calls 7
- class-const QueryMisuseRule::MultipleWith() line 89
- method-call QueryExpressionFacts::any() line 90
- class-const QueryMisuseRule::MultipleOrderBy() line 90
- class-const QueryMisuseRule::MultipleLimit() line 91
- class-const QueryMisuseRule::MultipleOffset() line 92
- method-call Derivation::report() line 96
- new QueryMisuse line 96
public function any(
list<SelectOptions|null> $options,
callable(SelectOptions): bool $condition,
): boolTells whether any of the options satisfies a condition.
Parameters
$options | list<SelectOptions|null> | |
$condition | callable(SelectOptions): bool |
Returns
boolTest cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::merged() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:90
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::merged() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:91
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::merged() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:92
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.