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

Lowers query statements and query bodies.

Rule: PG-SELECT-LOWER-001. Scope: SelectStmt, select_with_parens, select_no_parens, select_clause, simple_select, values_clause, set_quantifier, distinct_clause, opt_all_clause, opt_distinct_clause, into_clause, OptTempTableName, opt_target_list, target_list, target_el. Constructors: Select, TableQuery, ValuesList, SetOperation, ParenthesizedQuery, QueryExpression, ExpressionTarget, StarTarget, DistinctClause, IntoClause. Parentheses the grammar reads as grouping become ParenthesizedQuery; the parentheses a subquery requires are stripped by withParens. ORDER BY, LIMIT and locking clauses written directly after a selection or TABLE query belong to it; after anything else they belong to a QueryExpression. Termination: lists are flattened iteratively; nested queries 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 query(Node $query): Statement&Query

Lowers a query: SelectStmt, select_no_parens, select_with_parens (without its outer parentheses) or select_clause.

Parameters

$queryNode

Throws

ImplementationGap When the node is not a query
Test cases 1
Called from 1
Calls 5
public function attach(?Node $with, Node $clause, ?SelectOptions $options): Statement&Query

Builds a query body with the WITH clause before it and the options after it.

Parameters

$with?Node
$clauseNode
$options?SelectOptions

Throws

ImplementationGap When the WITH clause is not lowered to a WITH clause
Test cases 1
Called from 7
Calls 4
public function into(Node $clause): ?IntoClause

Lowers into_clause; no clause is null.

Parameters

$clauseNode

Returns

Throws

ImplementationGap When the production has no rule
Test cases 1
Called from 1
Calls 4

Private surface 3§

Implementation details, listed for orientation only.

private const PERSISTENCE = ['OptTempTableName: TEMPORARY opt_table qualified_name' => \SqlSemantics\Platfo…
private const OPERATORS = ['simple_select: select_clause UNION set_quantifier select_clause' => \SqlSeman…
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 5
Method calls 5