classGroupingRow
final class GroupingRow
implements Node
uses Snapshot
@visibility public.A parenthesized list of grouping terms in GROUP BY, ROLLUP, CUBE or GROUPING SETS: (a, 1).
A row written without ROW in a grouping position is not a row value: PostgreSQL's flatten_grouping_sets replaces such a row by the list of its fields, so GROUP BY (a, b) groups by a and b, and ROLLUP ((a, b), c) rolls a and b up together. Each field is a grouping term of its own: an integer constant is an output position, and an unqualified name may denote an output column. Nested rows are flattened the same way; a row with one member is a further pair of parentheses around a row. Source: https://www.postgresql.org/docs/17/queries-table-expressions.html#QUERIES-GROUPING-SETS.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 AS a GROUP BY (a, 1)');
[count($query->statement->groupBy[0]->members), $query->statement->groupBy[0]->members[1]::class] // => [2, \SqlSemantics\Platform\PostgreSql\Statement\Query\Clause\OutputPosition::class]new \SqlSemantics\Platform\PostgreSql\Statement\Query\Grouping\GroupingRow([new \SqlSemantics\Platform\PostgreSql\Statement\Literal\Constant(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\IntegerConstant('1')), new \SqlSemantics\Platform\PostgreSql\Statement\Literal\Constant(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\IntegerConstant('2'))]) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public non-empty-list<Scalar|GroupingRow> $membersMethods§
public function __construct(list<Scalar|GroupingRow> $members)Parameters
$members | list<Scalar|GroupingRow> | The members in written order: at least two, or one row in further parentheses |
Calls 8
- method-call ClosedList::of() line 48
- new ClosedList line 48
- class-const Scalar::class() line 48
- class-const GroupingRow::class() line 48
- static-call Check::input() line 49
- function-call
countline 49 - method-call Positions::value() line 51
- new Positions line 51
public function render(Output $out): voidTest cases 3§
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 2
Relations§
Instantiated in 2
Constant reads 2
- class-const SqlSemantics\Platform\PostgreSql\Statement\Query\Grouping\GroupingSet::__construct() packages/sql-semantics-postgres/src/Statement/Query/Grouping/GroupingSet.php:47
- class-const SqlSemantics\Platform\PostgreSql\Statement\Query\Select::__construct() packages/sql-semantics-postgres/src/Statement/Query/Select.php:94