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.

A partition has the columns of its parentdoctest
$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> $elements
public ParentTable $parent

Methods§

public function __construct(
    public ParentTable $parent,
    public PartitionBound $bound,
    list<Clause> $elements = [],
)

Parameters

$parentParentTableThe partitioned table
$boundPartitionBoundThe bound of the partition
$elementslist<Clause>The column options and table constraints
Calls 2
public function elements(): list<Clause>

Answers the elements in order.

Returns

list<Clause>
public function render(Output $out): void

Writes PARTITION OF, the parent, the parenthesized elements and the bound.

Parameters

$outOutput
Calls 3

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
Type declarations 1