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

Reports the definitions PostgreSQL rejects because a column is, or is not, a generated column.

Rule: PG-GENERATED-COLUMN-001. A generation expression may not use a generated column (cannot use generated column "b" in column generation expression, check_nested_generated, heap.c); a partition key, by name or in an expression, may not use one (cannot use generated column in partition key, ComputePartitionAttrs, tablecmds.c); a foreign key whose referencing columns include one may not have ON UPDATE SET NULL, SET DEFAULT or CASCADE, nor ON DELETE SET NULL or SET DEFAULT (invalid ON UPDATE action for foreign key constraint containing generated column, ATAddForeignKeyConstraint). A table column inherited by several parents must be generated in all or none (inherited column "b" has a generation conflict); a column definition, or the options of a partition column, merged into an inherited generated column may not have a default or an identity, and one merged into an inherited column that is not generated may not have a generation clause (child column "b" specifies generation expression; MergeAttributes). A column counts as generated when the expression resolves it to a declared generated column, or the declaration of the table or parent says so; the first such column is reported, in written order. Source: https://www.postgresql.org/docs/17/ddl-generated-columns.html, https://www.postgresql.org/docs/16/ddl-generated-columns.html, https://github.com/postgres/postgres/blob/REL_17_2/src/backend/commands/tablecmds.c, https://github.com/postgres/postgres/blob/REL_17_2/src/backend/catalog/heap.c. Termination: one pass over the expression, the parents and the elements. Status: Implemented.

Methods§

public function referenced(Derivation $derivation, Scalar $expression): ?Name
public function partitionKey(Derivation $derivation, Scalar $key): void
public function among(
    Derivation $derivation,
    Environment $environment,
    list<Name> $columns,
): bool

Tells whether the relation of an environment has a generated column among the named columns.

Parameters

$derivationDerivation
$environmentEnvironment
$columnslist<Name>

Returns

bool
Called from 1
Calls 2
public function columnKeys(Derivation $derivation, list<Clause> $qualifiers): void

Reports the referential actions of the REFERENCES constraints of a generated column definition.

Parameters

$derivationDerivation
$qualifierslist<Clause>The qualifiers of the column definition
Called from 1
Calls 2
public function inherited(Derivation $derivation, TableForm $form): void
public function merged(
    Derivation $derivation,
    Name $column,
    list<Clause> $qualifiers,
    bool $generated,
): void

Reports a column definition merged into an inherited column whose generation it does not fit.

Parameters

$derivationDerivation
$columnName
$qualifierslist<Clause>
$generatedboolWhether the inherited column is generated
Called from 1
Calls 10

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