classLimits
final class Limits
Derives the LIMIT, OFFSET and FETCH clauses and checks the locking clauses of a query.
Rule: PG-LIMIT-001. The count and the offset are evaluated once and see no column of their own query, only the enclosing queries. LIMIT with a comma is reported. WITH TIES without ORDER BY, and WITH TIES together with SKIP LOCKED, are reported. A locking clause names FROM items of its query, unqualified, by alias or table name; a name no FROM item has is reported. Terminates: one pass over the clauses. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-LIMIT, https://www.postgresql.org/docs/17/sql-select.html#SQL-FOR-UPDATE-SHARE. Status: Implemented.
Methods§
public function derive(
?SelectOptions $options,
Derivation $derivation,
Environment $outer,
): voidDerives the count and offset expressions of the options, which see the enclosing queries only.
Parameters
$options | ?SelectOptions | |
$derivation | Derivation | |
$outer | Environment |
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:64
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::options() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:130
Calls 5
- new Environment line 46
- method-call Derivation::report() line 49
- new QueryMisuse line 49
- class-const QueryMisuseRule::CommaLimit() line 49
- method-call Derivation::scalar() line 60
public function ties(list<SelectOptions> $layers, Derivation $derivation): voidReports WITH TIES without ORDER BY and WITH TIES with SKIP LOCKED.
Parameters
$layers | list<SelectOptions> | The options that apply to one query, innermost first |
$derivation | Derivation |
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:62
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::options() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:131
Calls 5
- class-const LockWait::SkipLocked() line 80
- method-call Derivation::report() line 84
- new QueryMisuse line 84
- class-const QueryMisuseRule::TiesWithoutOrderBy() line 84
- class-const QueryMisuseRule::TiesWithSkipLocked() line 87
public function locked(
list<LockingClause> $clauses,
list<VisibleRelation> $visible,
Derivation $derivation,
): voidReports the relations of locking clauses that are qualified or that no FROM item of the query has.
Parameters
$clauses | list<LockingClause> | |
$visible | list<VisibleRelation> | The relations of the FROM items of the query |
$derivation | Derivation |
Called from 1
Calls 8
- new Environment line 99
- method-call Derivation::report() line 103
- new QueryMisuse line 103
- class-const QueryMisuseRule::LockedRelationQualified() line 103
- method-call Visibility::admits() line 108
- new Visibility line 108
- new QualifiedName line 108
- class-const QueryMisuseRule::LockedRelationNotInFrom() line 111
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
LimitsTestcalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:62
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:64
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::options() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:124
Method calls 5
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:62
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:64
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::options() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:127
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::options() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:130
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::options() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:131