Skip to main content

TableSchema

Struct TableSchema 

Source
pub struct TableSchema {
Show 13 fields pub name: String, pub columns: Vec<ColumnSchema>, pub hot_tier_bytes: Option<u64>, pub foreign_keys: Vec<ForeignKeyConstraint>, pub uniqueness_constraints: Vec<UniquenessConstraint>, pub exclusion_constraints: Vec<ExclusionConstraint>, pub checks: Vec<CheckConstraint>, pub partition_role: Option<PartitionRole>, pub policies: Vec<PolicyDef>, pub row_security: bool, pub force_row_security: bool, pub owner: Option<String>, pub acl: Vec<AclItem>,
}

Fields§

§name: String§columns: Vec<ColumnSchema>§hot_tier_bytes: Option<u64>

v6.7.2 — per-table hot-tier byte budget override. None falls through to the global SPG_HOT_TIER_BYTES setting; Some(n) overrides it for this specific table. Set via ALTER TABLE t SET hot_tier_bytes = X. Persisted in catalog FILE_VERSION 11+.

§foreign_keys: Vec<ForeignKeyConstraint>

v7.6.1 — FOREIGN KEY constraints declared on this table. Engine maintains this in lock-step with spg-sql’s parser AST; the storage layer carries the on-disk shape so a catalog snapshot round-trips without external mapping. Persisted in catalog FILE_VERSION 13+. Older catalogs deserialise with an empty vec.

§uniqueness_constraints: Vec<UniquenessConstraint>

v7.9.19 — composite UNIQUE / PRIMARY KEY constraints declared at the table level. Each entry’s leading column has a BTree index (created via the constraint), and INSERT path enforces the full-tuple uniqueness via a scan keyed by the leading column. Persisted in catalog FILE_VERSION 15+. Older catalogs (≤ 14) deserialise with an empty vec.

§exclusion_constraints: Vec<ExclusionConstraint>

v7.39 (round 210) — EXCLUDE constraints declared at the table level. Enforced on INSERT/UPDATE by a full live-row scan re-checking each element’s operator (no equality index can answer overlap). Persisted in catalog FILE_VERSION 72+; older catalogs deserialise with an empty vec.

§checks: Vec<CheckConstraint>

v7.13.0 — CHECK (<expr>) predicates declared on this table. Both column-level inline CHECK (…) and table-level CHECK (…) fold into this list. Each entry is the AST Expr’s Display form, re-parsed on every INSERT/UPDATE and evaluated against the candidate row. A false / NULL result rejects the mutation (PG semantics). Persisted in catalog FILE_VERSION 23+. Older catalogs deserialise with an empty vec. v7.39 (read01 round 48) — each entry now carries the user’s constraint name too (FILE_VERSION 60+).

§partition_role: Option<PartitionRole>

v7.37.6-B — declarative partition role(sentori Epic 2 P0). None = 普通表(后向兼容,< v49 catalog 默认 None)。 Some(Parent { … }) = CREATE TABLE p (...) PARTITION BY RANGE (key_col) 父表 — 父表自己 rows 永远空,INSERT 在引擎层路由到命中的 child。 Some(Range { … }) = CREATE TABLE c PARTITION OF p FOR VALUES FROM (a) TO (b) 范围子表。 Some(Default { … }) = CREATE TABLE c PARTITION OF p DEFAULT 兜底子表。 持久化于 FILE_VERSION 49+。

§policies: Vec<PolicyDef>

v7.39 (RLS) — CREATE POLICY objects on this table, independent of the row_security flag (PG stores policies even on non-RLS tables; they only take effect once RLS is enabled). Persisted in the policy appendix (FILE_VERSION 59+). Older catalogs deserialise with an empty vec.

§row_security: bool

v7.39 (RLS) — ALTER TABLE … ENABLE ROW LEVEL SECURITY (PG pg_class.relrowsecurity). Fresh table = false.

§force_row_security: bool

v7.39 (RLS) — ALTER TABLE … FORCE ROW LEVEL SECURITY (PG pg_class.relforcerowsecurity); subjects the table owner to RLS too. Fresh table = false.

§owner: Option<String>

v7.39 (read01 round 57, ACL) — the role that owns this table: whoever ran CREATE TABLE (PG pg_class.relowner). The owner holds every privilege implicitly and is the only role that may ALTER / DROP it. None = an image written before FILE_VERSION 64, which predates roles entirely; those tables read back as owned by the login role.

§acl: Vec<AclItem>

v7.39 (read01 round 57, ACL) — explicit GRANTs on this table (PG pg_class.relacl). EMPTY means “never granted”: PG leaves relacl NULL while only the owner’s implicit privileges apply, and materialises the whole list — owner’s default entry included — on the first GRANT. Once materialised it stays, even after every grant is revoked.

Implementations§

Source§

impl TableSchema

Source

pub fn column_position(&self, name: &str) -> Option<usize>

Source§

impl TableSchema

Source

pub fn new(name: impl Into<String>, columns: Vec<ColumnSchema>) -> Self

Trait Implementations§

Source§

impl Clone for TableSchema

Source§

fn clone(&self) -> TableSchema

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 TableSchema

Source§

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

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

impl PartialEq for TableSchema

Source§

fn eq(&self, other: &TableSchema) -> 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 TableSchema

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.