classKeyColumns
final class KeyColumns
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.
Checks the column names a key, an index, a foreign key or a column list names against a row shape.
Rule: PG-KEY-COLUMNS-001. A name is found among the slots of the shape by exact comparison of the decoded names (identifiers are folded when they are read). Only a complete shape can show that a column is absent; an open shape reports nothing. Source: https://www.postgresql.org/docs/17/sql-createtable.html. Termination: one pass over the names and slots. Status: Implemented.
Methods§
public function position(Derivation $derivation, RowShape $shape, Name $name): ?intAnswers the position of a named slot, or null when the shape has none of that name.
Parameters
$derivation | Derivation | |
$shape | RowShape | |
$name | Name |
Returns
?intTest cases 1
Called from 6
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::identity() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:95
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::column() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:147
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\GeneratedChanges::generated() packages/sql-semantics-postgres/src/Rules/Table/Command/GeneratedChanges.php:90
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\GeneratedColumns::among() packages/sql-semantics-postgres/src/Rules/Table/Definition/GeneratedColumns.php:110
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\KeyColumns::report() packages/sql-semantics-postgres/src/Rules/Table/KeyColumns.php:52
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Alter\Column\AddIdentity::deriveClause() packages/sql-semantics-postgres/src/Statement/Table/Alter/Column/AddIdentity.php:60
public function report(
Derivation $derivation,
list<Name> $names,
RowShape $shape,
DefinitionRule $rule,
): voidReports each name a complete shape lacks.
Parameters
$derivation | Derivation | |
$names | list<Name> | |
$shape | RowShape | |
$rule | DefinitionRule |
Called from 2
Calls 4
- method-call RowShape::complete() line 48
- method-call KeyColumns::position() line 52
- method-call Derivation::report() line 53
- new DefinitionProblem line 53
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 7
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::identity() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:95
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::column() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:147
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Command\GeneratedChanges::generated() packages/sql-semantics-postgres/src/Rules/Table/Command/GeneratedChanges.php:90
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\GeneratedColumns::among() packages/sql-semantics-postgres/src/Rules/Table/Definition/GeneratedColumns.php:107
- new SqlSemantics\Platform\PostgreSql\Rules\Table\ForeignKeys::derive() packages/sql-semantics-postgres/src/Rules/Table/ForeignKeys.php:71
- new SqlSemantics\Platform\PostgreSql\Rules\Table\KeyClauses::derive() packages/sql-semantics-postgres/src/Rules/Table/KeyClauses.php:37
- new SqlSemantics\Platform\PostgreSql\Statement\Table\Alter\Column\AddIdentity::deriveClause() packages/sql-semantics-postgres/src/Statement/Table/Alter/Column/AddIdentity.php:60
Method calls 7
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::identity() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:95
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::column() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:147
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\GeneratedChanges::generated() packages/sql-semantics-postgres/src/Rules/Table/Command/GeneratedChanges.php:90
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\GeneratedColumns::among() packages/sql-semantics-postgres/src/Rules/Table/Definition/GeneratedColumns.php:110
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\ForeignKeys::derive() packages/sql-semantics-postgres/src/Rules/Table/ForeignKeys.php:71
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\KeyClauses::derive() packages/sql-semantics-postgres/src/Rules/Table/KeyClauses.php:37
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Alter\Column\AddIdentity::deriveClause() packages/sql-semantics-postgres/src/Statement/Table/Alter/Column/AddIdentity.php:60