final class ColumnPrimaryKey
    implements Constraint
    uses Snapshot
Public API: explicitly declared with @visibility public.

A PRIMARY KEY column constraint: the column is unique and never NULL.

Mirrors CONSTR_PRIMARY with options and indexspace. Source: https://www.postgresql.org/docs/17/sql-createtable.html.

A primary key column is never NULLdoctest
$create = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE TABLE t (a int PRIMARY KEY)');
    $create->declarations()[0]->columns[0]->nullability // => \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\Nullability::NotNull

Properties§

public list<Definition> $options
public Name|null $tablespace = null
public Name|null $name = null

Methods§

public function __construct(
    list<Definition> $options = [],
    public Name|null $tablespace = null,
    public Name|null $name = null,
)

Parameters

$optionslist<Definition>The storage parameters of the index
$tablespaceName|nullThe tablespace of the index
$nameName|nullThe constraint name
Calls 2
public function kind(): ConstraintKind

Answers the kind of the constraint.

Calls 1
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the storage parameters.

Parameters

$derivationDerivation
$environmentEnvironment
public function render(Output $out): void

Writes the constraint.

Parameters

$outOutput
Calls 4

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
Constant reads 1
Type checks 3