final class ClauseRule
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.

Lowers the clauses of a selection and the clauses written after a query body.

Rule: PG-CLAUSE-LOWER-001. Scope: where_clause, group_clause, group_by_list, group_by_item, empty_grouping_set, rollup_clause, cube_clause, grouping_sets_clause, having_clause, window_clause, window_definition_list, window_definition, opt_sort_clause, sort_clause, sortby_list, sortby, opt_asc_desc, opt_nulls_order. Constructors: SortItem, GroupingSet, WindowDefinition, OutputPosition, SelectOptions. An integer constant written as an ORDER BY, GROUP BY or DISTINCT ON term becomes an OutputPosition (PG-OUTPUT-POSITION-001); in the ORDER BY of an aggregate or a window it stays a constant. Termination: lists are flattened iteratively; grouping sets recurse on the tree depth. Source: https://www.postgresql.org/docs/17/sql-select.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe hub
public function options(
    Node $sort,
    ?Node $limit,
    ?Node $locking,
    bool $lockingFirst,
): ?SelectOptions

Lowers the ORDER BY, LIMIT and locking clauses written after a query body; none is null.

Parameters

$sortNode
$limit?Node
$locking?Node
$lockingFirstbool
Test cases 2
Called from 6
Calls 8
public function sortClause(Node $clause): list<SortItem>
public function having(Node $clause): ?Scalar

Lowers having_clause; no clause is null.

Parameters

$clauseNode

Returns

Throws

ImplementationGap When the production has no rule
Test cases 1
Called from 1
Calls 1
public function group(Node $clause): array{SetQuantifier|null, list<Scalar|GroupingRow|GroupingSet>}

Lowers group_clause: the quantifier and the items; no clause has neither.

Parameters

$clauseNode

Returns

array{SetQuantifier|null, list<Scalar|GroupingRow|GroupingSet>}

Throws

ImplementationGap When the production has no rule
Test cases 1
Called from 1
Calls 4
public function groupingSet(Node $set): GroupingSet
public function windows(Node $clause): list<WindowDefinition>

Private surface 1§

Implementation details, listed for orientation only.

private Lowering $lowering

Test cases 14§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 13
Other tests reaching this symbol 1

Relations§

Instantiated in 7
Method calls 15