classPartitionSpec
final class PartitionSpec
implements Clause
uses Snapshot
Public API: explicitly declared with
@visibility public.PARTITION BY: the strategy and the key of a partitioned table.
Mirrors PostgreSQL's PartitionSpec. The grammar reads the strategy as a name; the server accepts LIST, RANGE and HASH in any letter case and reports any other word. Source: https://www.postgresql.org/docs/17/sql-createtable.html, https://www.postgresql.org/docs/17/ddl-partitioning.html.
$create = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE TABLE t (a int) PARTITION BY HASH (a)');
$create->statement->partitioning->strategy->value // => 'hash'Properties§
public non-empty-list<PartitionElement> $elementspublic Name $strategyMethods§
public function __construct(public Name $strategy, list<PartitionElement> $elements)Parameters
$strategy | Name | The strategy word |
$elements | list<PartitionElement> | The key; at least one element |
Calls 2
- static-call Check::listOf() line 46
- class-const PartitionElement::class() line 46
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the key against the table and reports an unknown strategy.
Parameters
$derivation | Derivation | |
$environment | Environment |
Calls 7
- function-call
in_arrayline 54 - function-call
strtolowerline 54 - method-call Derivation::report() line 55
- new DefinitionProblem line 55
- class-const DefinitionRule::PartitionStrategy() line 55
- new GeneratedColumns line 57
- method-call GeneratedColumns::partitionKey() line 60
public function render(Output $out): voidWrites PARTITION BY, the strategy and the key.
Parameters
$out | Output |
Calls 1
- method-call Output::keyword() line 69
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
PartitionSpecTestcalls