final class Grouped
    implements Scalar, OutputNaming
    uses Snapshot
Public API: explicitly declared with @visibility public.

An expression written in parentheses: ( a_expr ).

The raw parser of PostgreSQL keeps no node for the parentheses, but they fix the evaluation structure of what they enclose, so the model keeps them as written; rendering never adds or removes a grouping.

Rule: PG-GROUPED-001. The type, the NULL fact and the output name are those of the operand; the name resolution stays with the operand. A query in parentheses is a scalar subquery, and more parentheses around it belong to the query, so a grouping never encloses a scalar subquery. Source: https://www.postgresql.org/docs/17/sql-expressions.html. Status: Implemented.

Keeping the parentheses writtendoctest
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT (1 + 2) * 3')->toString() // => 'SELECT (1 + 2) * 3'

Properties§

public Scalar $operand

Methods§

public function __construct(public Scalar $operand)

Parameters

$operandScalarThe enclosed expression; not a scalar subquery
Calls 1
public function outputName(): ?Name

Names an unaliased result column as the operand does.

Returns

Test cases 1
Calls 2
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand; the grouping has its type and NULL fact.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operand in parentheses.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 13§

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

Dedicated tests 4
Other tests reaching this symbol 9

Relations§

Instantiated in 1
Type checks 13