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

Reports the ALTER TABLE column actions that do not fit whether the column is a generated column.

Rule: PG-ALTER-GENERATED-001. SET DEFAULT and DROP DEFAULT refuse a generated column (column "b" of relation "t" is a generated column, ATExecColumnDefault; the server hints at SET EXPRESSION or DROP EXPRESSION), unless the same statement drops its generation expression, which runs first. DROP EXPRESSION without IF EXISTS refuses a column that is not a stored generated column (column "a" of relation "t" is not a stored generated column, ATExecDropExpression); with IF EXISTS the server only notices it. SET EXPRESSION, from PostgreSQL 17, refuses a column that is not a generated column (ATExecSetExpression). SET DATA TYPE with USING refuses a generated column (cannot specify USING when altering type of generated column, ATPrepAlterColumnType). A column counts when the declared column list of the relation is complete and holds it. Source: https://www.postgresql.org/docs/17/sql-altertable.html, https://www.postgresql.org/docs/16/sql-altertable.html, https://github.com/postgres/postgres/blob/REL_17_2/src/backend/commands/tablecmds.c. Termination: one pass over the commands. Status: Implemented.

Methods§

public function check(Derivation $derivation, RowShape $shape, AlterTable $alter): void
public function rule(
    DefaultChange|ColumnAction|SetExpression $command,
    bool|null $generated,
    bool $dropped,
): ?DefinitionRule

Answers the rule a column action breaks, or null.

Parameters

$commandDefaultChange|ColumnAction|SetExpression
$generatedbool|nullWhether the column is generated, or null when the relation does not tell
$droppedboolWhether the statement drops the generation expression of the column
Called from 1
Calls 5
public function generated(Derivation $derivation, RowShape $shape, Name $column): ?bool
public function dropped(Derivation $derivation, AlterTable $alter, Name $column): bool

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