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

The entry point of the query family.

Rule: PG-QUERY-001. Every other family reaches the query rules through these methods: PG-SELECT-LOWER-001, PG-CLAUSE-LOWER-001, PG-LIMIT-LOWER-001, PG-WITH-LOWER-001, PG-FROM-LOWER-001 and PG-TABLE-FUNCTION-LOWER-001. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe hub
public function statement(Node $statement): Statement
public function query(Node $query): Query&Statement

Lowers a query: SelectStmt, select_no_parens, select_with_parens or select_clause.

A select_with_parens is lowered to the query inside its outer parentheses: the holder of a subquery writes the parentheses it requires.

Parameters

$queryNode
Calls 2
public function sortClause(Node $clause): list<SortItem>

Lowers sort_clause, opt_sort_clause or sortby_list of an aggregate, a window or WITHIN GROUP; no clause is an empty list.

An integer constant stays a constant here: only the ORDER BY of a query reads it as an output position.

Parameters

$clauseNode

Returns

list<SortItem>
Calls 2
public function sortDirection(Node $direction): ?SortDirection

Lowers opt_asc_desc; no direction is null.

Parameters

$directionNode
Calls 2
public function nullsOrder(Node $order): ?NullsOrder

Lowers opt_nulls_order; no clause is null.

Parameters

$orderNode

Returns

Calls 2
public function where(Node $clause): ?Scalar

Lowers where_clause; no clause is null.

Parameters

$clauseNode

Returns

Calls 2
public function from(Node $clause): list<Relation>

Lowers from_clause or from_list; no clause is an empty list.

Parameters

$clauseNode

Returns

list<Relation>
Calls 2
public function fromItem(Node $clause): ?Relation

Lowers from_clause or from_list to its one item or to the RelationList of its items; no clause is null.

Parameters

$clauseNode

Returns

Calls 2
public function relation(Node $relation): RelationReference

Lowers relation_expr or extended_relation_expr: a table name with its ONLY or * inheritance marker.

Parameters

$relationNode
Calls 2
public function tableReference(Node $reference): Relation

Lowers table_ref: one item of a FROM list, or the source of MERGE.

Parameters

$referenceNode

Returns

Calls 2
public function relations(Node $list): list<RelationReference>

Lowers relation_expr_list.

Parameters

$listNode

Returns

Calls 2
public function targets(Node $list): list<Target>

Lowers target_list or opt_target_list; no list is empty.

Parameters

$listNode

Returns

list<Target>
Calls 2
public function with(Node $clause): ?CommonTables

Lowers with_clause or opt_with_clause; no clause is null.

Parameters

$clauseNode

Returns

Calls 2

Private surface 1§

Implementation details, listed for orientation only.

private Lowering $lowering

Test cases 13§

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

Dedicated tests 13

Relations§

Instantiated in 1
Method calls 1
Type declarations 1