final class Alterations
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.

Derives ALTER TABLE and the other commands built on AlterTableStmt.

Rule: PG-ALTER-TABLE-001. The altered relation is resolved (PG-TABLE-TARGET-001) and is the relation fact of the statement; the statement changes no declaration ("ALTER ... does not change the

  • context"). Each action is derived where the relation is the only visible

relation, its system columns included; the expressions of an added column also see that column. A column an action names must be a column of a relation whose column list is complete, unless IF EXISTS is written. The kind the relation is written with and the actions must fit its declared kind (PG-RELATION-KIND-001, PG-ALTER-KIND-001). An identity can be added only to a column that is NOT NULL, as declared or made by SET NOT NULL or a primary key in the same statement ("must be declared NOT NULL before

  • identity can be added", ATExecAddIdentity). The column actions must fit

the generated columns of the relation (PG-ALTER-GENERATED-001). Source: https://www.postgresql.org/docs/17/sql-altertable.html. Termination: one pass over the actions. Status: Implemented.

Methods§

public function identity(
    Derivation $derivation,
    RowShape $shape,
    AlterTable $alter,
    Name $column,
): void

Reports an identity added to a column the declaration lets be NULL.

The column must be NOT NULL when the identity is added; a SET NOT NULL or a primary key on the column in the same statement runs first.

Parameters

$derivationDerivation
$shapeRowShape
$alterAlterTable
$columnName
Called from 1
Calls 8
public function column(
    Derivation $derivation,
    Environment $environment,
    Name|IntegerConstant $column,
): void

Reports a column the action names that the complete row shape of the relation lacks.

Parameters

$derivationDerivation
$environmentEnvironment
$columnName|IntegerConstant
Called from 11
Calls 5
public function admits(list<AlterCommand> $commands): bool

Tells whether the actions of a command list may stand together: a partition action stands alone.

Parameters

$commandslist<AlterCommand>

Returns

bool
Test cases 1
Called from 1
Calls 1

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 13
Method calls 13