classDetachPartition
final class DetachPartition
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.DETACH PARTITION: makes a partition a stand-alone table.
Mirrors AT_DetachPartition (concurrent) and AT_DetachPartitionFinalize. The partition is resolved and is the relation fact of its node. Source: https://www.postgresql.org/docs/17/sql-altertable.html.
$statement = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER TABLE p DETACH PARTITION p1 FINALIZE');
$statement->statement->commands[0]->mode // => \SqlSemantics\Platform\PostgreSql\Statement\Table\Partition\DetachMode::FinalizeProperties§
public ParentTable $partitionpublic DetachMode $mode = DetachMode::PlainMethods§
public function __construct(
public ParentTable $partition,
public DetachMode $mode = DetachMode::Plain,
)Parameters
$partition | ParentTable | The partition |
$mode | DetachMode | How the partition is detached |
Calls 1
- class-const DetachMode::Plain() line 35
public function deriveClause(Derivation $derivation, Environment $environment): voidResolves the partition.
Parameters
$derivation | Derivation | |
$environment | Environment |
Calls 3
- method-call Derivation::target() line 44
- method-call Targets::resolve() line 44
- new Targets line 44
public function render(Output $out): voidWrites the action.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 52
- class-const DetachMode::Plain() line 53
Test cases 2§
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 1
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterTableRule::partition() packages/sql-semantics-postgres/src/Lowering/Table/AlterTableRule.php:136
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterTableRule::partition() packages/sql-semantics-postgres/src/Lowering/Table/AlterTableRule.php:137
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\AlterKinds::relationWide() packages/sql-semantics-postgres/src/Rules/Table/Command/AlterKinds.php:189
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::admits() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:164