classPartitionOf
final class PartitionOf
implements TableForm
uses Snapshot
Public API: explicitly declared with
@visibility public.A partition: its columns are those of the partitioned parent, and its bound says which rows it holds.
Mirrors the partbound form of PostgreSQL's CreateStmt. The parent is resolved; a declared parent gives the new table its columns, types and NOT NULL facts (PG-TABLE-DECLARATION-001). Source: https://www.postgresql.org/docs/17/sql-createtable.html, https://www.postgresql.org/docs/17/ddl-partitioning.html.
$semantics = new \SqlSemantics\Platform\PostgreSql\Semantics();
$parent = $semantics->analyze('CREATE TABLE p (id int NOT NULL, day date) PARTITION BY RANGE (day)', []);
$part = $semantics->analyze("CREATE TABLE p1 PARTITION OF p FOR VALUES FROM ('2024-01-01') TO (MAXVALUE)", $parent->declarations());
array_map(static fn ($column) => $column->name->value, $part->declarations()[0]->columns) // => ['id', 'day']Properties§
public list<Clause> $elementspublic ParentTable $parentpublic PartitionBound $boundMethods§
public function __construct(
public ParentTable $parent,
public PartitionBound $bound,
list<Clause> $elements = [],
)Parameters
$parent | ParentTable | The partitioned table |
$bound | PartitionBound | The bound of the partition |
$elements | list<Clause> | The column options and table constraints |
Calls 2
- method-call TableConstraints::typedElements() line 44
- new TableConstraints line 44
public function render(Output $out): voidWrites PARTITION OF, the parent, the parenthesized elements and the bound.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 62
- method-call Output::symbol() line 64
- method-call Output::node() line 66
Test 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 1
Type checks 4
- instanceof SqlSemantics\Platform\PostgreSql\Lowering\Table\CreateTableRule::foreign() packages/sql-semantics-postgres/src/Lowering/Table/CreateTableRule.php:112
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\Declarations::table() packages/sql-semantics-postgres/src/Rules/Table/Definition/Declarations.php:68
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\Definitions::elements() packages/sql-semantics-postgres/src/Rules/Table/Definition/Definitions.php:128
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\GeneratedColumns::inherited() packages/sql-semantics-postgres/src/Rules/Table/Definition/GeneratedColumns.php:166