pub struct DomainDef {
pub name: String,
pub base_type: DataType,
pub nullable: bool,
pub default: Option<String>,
pub checks: Vec<DomainCheck>,
pub base_domain: Option<String>,
}Expand description
default / checks are stored as Display-form source so
spg-storage stays free of spg-sql dependency — same
pattern as FunctionDef / ViewDef.
Fields§
§name: String§base_type: DataType§nullable: bool§default: Option<String>§checks: Vec<DomainCheck>v7.39 (round 260) — each CHECK carries its constraint NAME, so
ALTER DOMAIN … DROP CONSTRAINT <name> can find it and the
violation message can report the constraint that actually failed.
PG’s auto-naming for an unnamed check is <domain>_check, then
_check1, _check2, … (probed).
base_domain: Option<String>v7.39 (round 258/259) — when this domain was declared over ANOTHER
domain (CREATE DOMAIN child AS parent CHECK (…)), the parent’s
name. base_type is the ultimate scalar type either way, so
without this the parent’s constraints were invisible and a value
violating them was silently accepted. PG checks the whole chain,
base-first, and an ALTER DOMAIN on the parent takes effect for
the child immediately (probed) — so the chain is walked at check
time rather than copied at CREATE time. Catalog FILE_VERSION 74+.