final class ExchangePartition
    implements StandaloneCommand
    uses Snapshot
Public API: explicitly declared with @visibility public.

EXCHANGE PARTITION p WITH TABLE t [WITH | WITHOUT VALIDATION]: a request to swap a partition with an unpartitioned table.

Mirrors PT_alter_table_exchange_partition. The other table resolves by MYSQL-CHANGE-TARGET-001 and its resolution is the relation fact of this node. The validation option exists from 5.7 on. Source: https://dev.mysql.com/doc/refman/8.4/en/partitioning-management-exchange.html.

Swapping a partition with a tabledoctest
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t EXCHANGE PARTITION p0 WITH TABLE u WITHOUT VALIDATION');
    [$alter->statement->commands[0]->table->name->value, $alter->statement->commands[0]->validation?->validate] // => ['u', false]

Properties§

public Name $partition
public QualifiedName $table
public ValidationOption|null $validation = null

Methods§

public function __construct(
    public Name $partition,
    public QualifiedName $table,
    public ValidationOption|null $validation = null,
)

Parameters

$partitionNameThe partition
$tableQualifiedNameThe table to swap with
$validationValidationOption|nullWITH or WITHOUT VALIDATION, when written
Calls 1
public function deriveCommand(Derivation $derivation, Environment $scope): void

Records the resolution of the other table.

Parameters

$derivationDerivation
$scopeEnvironment
Calls 3
public function render(Output $out): void

Writes the action.

Parameters

$outOutput
Calls 5

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Type declarations 1