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

A UNIQUE column constraint: no two rows hold the same value in the column.

Mirrors CONSTR_UNIQUE with nulls_not_distinct, options and indexspace. NULLS DISTINCT is the default and is kept when written. Source: https://www.postgresql.org/docs/17/sql-createtable.html.

Reading how NULL values countdoctest
$create = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE TABLE t (a int UNIQUE NULLS NOT DISTINCT)');
    $create->statement->definition->elements[0]->qualifiers[0]->nullsDistinct // => false

Properties§

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

Methods§

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

Parameters

$nullsDistinctbool|nullTrue for NULLS DISTINCT, false for NULLS NOT DISTINCT, null when not written
$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 5

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 1