classColumnPrimaryKey
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.
$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::NotNullProperties§
public list<Definition> $optionspublic Name|null $tablespace = nullpublic Name|null $name = nullMethods§
public function __construct(
list<Definition> $options = [],
public Name|null $tablespace = null,
public Name|null $name = null,
)Parameters
$options | list<Definition> | The storage parameters of the index |
$tablespace | Name|null | The tablespace of the index |
$name | Name|null | The constraint name |
Calls 2
- static-call Check::listOf() line 45
- class-const Definition::class() line 45
public function kind(): ConstraintKindpublic function deriveClause(Derivation $derivation, Environment $environment): voidDerives the storage parameters.
Parameters
$derivation | Derivation | |
$environment | Environment |
public function render(Output $out): voidWrites the constraint.
Parameters
$out | Output |
Calls 4
- new Writing line 71
- method-call Writing::constraintName() line 72
- method-call Output::keyword() line 73
- method-call Writing::indexParameters() line 74
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
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\Declarations::notNull() packages/sql-semantics-postgres/src/Rules/Table/Definition/Declarations.php:182
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\Definitions::report() packages/sql-semantics-postgres/src/Rules/Table/Definition/Definitions.php:162
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Definition\Qualifiers::attributes() packages/sql-semantics-postgres/src/Rules/Table/Definition/Qualifiers.php:111