final class ParenthesizedQuery
    implements Statement, Query, OutputNaming
    uses Snapshot
Public API: explicitly declared with @visibility public.

A query in parentheses where the grammar treats the parentheses as grouping.

Mirrors select_with_parens: PostgreSQL keeps no node for the parentheses, so the query has the output of the query inside, and clauses written after the parentheses apply to that query. The parentheses that a subquery or a derived table requires are written by their holder, not by this node. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-UNION.

Keeping the grouping of set operationsdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 UNION (SELECT 2 UNION SELECT 3)');
    [$query->statement->right instanceof \SqlSemantics\Platform\PostgreSql\Statement\Query\ParenthesizedQuery, $query->toString()] // => [true, 'SELECT 1 UNION (SELECT 2 UNION SELECT 3)']

Properties§

public Query $query

Methods§

public function __construct(public Query $query)

Parameters

$queryQueryThe query inside the parentheses
public function outputName(): ?Name

Answers the name of the first output column of the query inside.

Returns

Calls 1
public function deriveStatement(Derivation $derivation): void

Derives the query as a statement root.

Parameters

$derivationDerivation
Calls 2
public function deriveQuery(Derivation $derivation, Environment $outer): QueryFact

Derives the query inside, whose output it has.

Parameters

$derivationDerivation
$outerEnvironment

Returns

Calls 1
public function render(Output $out): void

Writes the query in parentheses.

Parameters

$outOutput
Calls 1

Test cases 6§

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

Dedicated tests 1
Other tests reaching this symbol 5

Relations§

Instantiated in 3
Type checks 15