Skip to main content

UniquenessConstraint

Struct UniquenessConstraint 

Source
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: bool

true 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: bool

v7.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: bool

v7.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: bool

INITIALLY DEFERRED: the check belongs to COMMIT, not the statement, unless SET CONSTRAINTS … IMMEDIATE pulls it in.

Trait Implementations§

Source§

impl Clone for UniquenessConstraint

Source§

fn clone(&self) -> UniquenessConstraint

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UniquenessConstraint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for UniquenessConstraint

Source§

impl PartialEq for UniquenessConstraint

Source§

fn eq(&self, other: &UniquenessConstraint) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UniquenessConstraint

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.