classParenthesizedQuery
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.
$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 $queryMethods§
public function __construct(public Query $query)Parameters
$query | Query | The query inside the parentheses |
public function outputName(): ?NameAnswers the name of the first output column of the query inside.
Returns
?NameCalls 1
- method-call Query::outputName() line 49
public function deriveStatement(Derivation $derivation): voidDerives the query as a statement root.
Parameters
$derivation | Derivation |
Calls 2
- method-call QueryRoots::derive() line 57
- new QueryRoots line 57
public function deriveQuery(Derivation $derivation, Environment $outer): QueryFactDerives the query inside, whose output it has.
Parameters
$derivation | Derivation | |
$outer | Environment |
Returns
Calls 1
- method-call Derivation::query() line 65
public function render(Output $out): voidTest 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
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::statement() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:97
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::withParens() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:129
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::clause() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:187
Type checks 15
- instanceof SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::rows() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:109
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Sources::statement() packages/sql-semantics-postgres/src/Rules/Manipulation/Sources.php:35
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Sources::insertable() packages/sql-semantics-postgres/src/Rules/Manipulation/Sources.php:44
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Carriers::core() packages/sql-semantics-postgres/src/Rules/Query/Carriers.php:36
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Carriers::core() packages/sql-semantics-postgres/src/Rules/Query/Carriers.php:37
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\ModifyingCommonTables::top() packages/sql-semantics-postgres/src/Rules/Query/Facts/ModifyingCommonTables.php:58
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\ModifyingCommonTables::top() packages/sql-semantics-postgres/src/Rules/Query/Facts/ModifyingCommonTables.php:59
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::merged() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:77
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::merged() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:82
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryRoots::first() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryRoots.php:70
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryRoots::first() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryRoots.php:72
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Routine\BodyFacts::first() packages/sql-semantics-postgres/src/Rules/Routine/BodyFacts.php:63
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Routine\BodyFacts::first() packages/sql-semantics-postgres/src/Rules/Routine/BodyFacts.php:65
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Query\QueryExpression::__construct() packages/sql-semantics-postgres/src/Statement/Query/QueryExpression.php:53
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Query\SetOperation::__construct() packages/sql-semantics-postgres/src/Statement/Query/SetOperation.php:55