pub struct UniquenessConstraint {
pub is_primary_key: bool,
pub columns: Vec<usize>,
pub nulls_not_distinct: bool,
pub name: Option<String>,
pub deferrable: bool,
pub initially_deferred: bool,
}Fields§
§is_primary_key: booltrue when this constraint was declared as PRIMARY KEY
(vs UNIQUE). Semantically PK implies NOT NULL on all
referenced columns; the engine enforces that at CREATE
TABLE time.
columns: Vec<usize>Column positions on the parent table. ≥ 1 element. For single-column UNIQUE this is exactly one position; the BTree index alone enforces it.
nulls_not_distinct: boolv7.13.0 — UNIQUE NULLS NOT DISTINCT modifier
(mailrs round-5 G10; PG 15+ surface). When true, two
rows whose constrained columns are all NULL collide on
the constraint. Default (false) is the SQL-standard
NULLS DISTINCT behaviour where any NULL passes.
Persisted in catalog FILE_VERSION 23+.
name: Option<String>v7.39 (read01 round 48) — the constraint’s SQL name when the user
supplied one (ADD CONSTRAINT <name> PRIMARY KEY/UNIQUE (...), or
the inline CONSTRAINT <name> form). None = unnamed, in which
case pg_constraint synthesises PG’s <table>_pkey /
<table>_<col>_key form. DROP CONSTRAINT resolves the stored name
first and falls back to the synthesised one, so catalogs written
before this field (< FILE_VERSION 60) keep working unchanged.
deferrable: boolv7.39 (round 711) — [NOT] DEFERRABLE. Round 621 taught the parser
to CONSUME the clause on PK/UNIQUE (the FK path had stored it since
round 288); this is the storing half. Persisted in the v89 timing
appendix.
initially_deferred: boolINITIALLY DEFERRED: the check belongs to COMMIT, not the
statement, unless SET CONSTRAINTS … IMMEDIATE pulls it in.
Trait Implementations§
Source§impl Clone for UniquenessConstraint
impl Clone for UniquenessConstraint
Source§fn clone(&self) -> UniquenessConstraint
fn clone(&self) -> UniquenessConstraint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more