pub struct CompositeDef {
pub name: String,
pub fields: Vec<(String, DataType)>,
pub field_user_types: Vec<Option<String>>,
}Expand description
v7.37.42-T2 ζ-B — catalogued user-defined COMPOSITE type
(CREATE TYPE name AS (field_name field_type, ...)). Order
matters: PG composite literals are positional, and SPG mirrors
that. Stored as ordered (name, DataType) pairs to keep the
codec straightforward and to allow eventual Value::Composite
bodies to encode positionally. Persisted in catalog FILE_VERSION
52+; older catalogs deserialise with an empty composite_types
map. Composite types can be used as a column type by spelling
the composite’s name; the resolution from
ColumnSchema.user_composite_type = Some(name) happens at the
engine boundary (parallel to user_enum_type /
user_domain_type). The dense storage shape — JSON-text body
keyed by the composite’s field list — keeps the codec free of
recursive Value bodies until the full Value::Composite arena
migration in a later phase.
Fields§
§name: String§fields: Vec<(String, DataType)>Ordered (field_name, field_type) pairs. PG composite
literals are positional, so order is part of the type’s
identity.
field_user_types: Vec<Option<String>>v7.39 (round 264) — parallel to fields: the USER type name of
each field when it is itself a composite (or another named user
type). DataType has no room for one, so a nested composite
field resolved to the parser’s Text placeholder and the inner
record stayed TEXT — (x).inner.street errored, pg_typeof
said text, and row_to_json nested a string instead of an
object. Same shape as ColumnSchema.user_composite_type and
DomainDef.base_domain. Catalog FILE_VERSION 76+; an older
catalog reads all-None, which is what it meant.
Trait Implementations§
Source§impl Clone for CompositeDef
impl Clone for CompositeDef
Source§fn clone(&self) -> CompositeDef
fn clone(&self) -> CompositeDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more