classCarriers
final class Carriers
Hands the ORDER BY and locking clauses written after parentheses down to the selection inside them.
Rule: PG-QUERY-OPTIONS-001. PostgreSQL attaches the clauses written after a parenthesized query to the query inside the parentheses, so that ORDER BY and FOR UPDATE after (SELECT … FROM t) see t. The query expression that holds such clauses passes itself to the body as a carrier in the environment: a visible occurrence of class Carrier with neither alias, name nor column, which no name lookup can reach. The selection or TABLE query the clauses belong to takes the carriers addressed to it and derives their clauses in its own environment; every other query ignores them. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-ORDERBY. Status: Implemented.
Methods§
Answers the query a body stands for once parentheses and the clauses around it are set aside.
Parameters
$query | Query |
Returns
Test cases 1
Called from 4
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Carriers::take() packages/sql-semantics-postgres/src/Rules/Query/Carriers.php:61
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\CommonTableFacts::recursiveForm() packages/sql-semantics-postgres/src/Rules/Query/Facts/CommonTableFacts.php:168
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:49
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::rebound() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:99
public function carry(Environment $environment, QueryExpression $carrier): EnvironmentAnswers the environment with a carrier added at the same query level.
Parameters
$environment | Environment | |
$carrier | QueryExpression |
Returns
Test cases 2
Called from 1
Calls 4
- new Environment line 48
- new VisibleRelation line 48
- new Carrier line 48
- new RowShape line 48
public function take(
Environment $environment,
Query $query,
): array{Environment, list<QueryExpression>}Answers the environment without the carriers addressed to a query, and those carriers, outermost first.
Parameters
$environment | Environment | |
$query | Query |
Returns
array{Environment, list<QueryExpression>}Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:60
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:106
Calls 2
- method-call Carriers::core() line 61
- new Environment line 71
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 5
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\CommonTableFacts::recursiveForm() packages/sql-semantics-postgres/src/Rules/Query/Facts/CommonTableFacts.php:168
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:48
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:60
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:106
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::rebound() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:99
Method calls 6
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\CommonTableFacts::recursiveForm() packages/sql-semantics-postgres/src/Rules/Query/Facts/CommonTableFacts.php:168
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:49
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:51
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:60
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:106
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SetOperationFacts::rebound() packages/sql-semantics-postgres/src/Rules/Query/Facts/SetOperationFacts.php:99