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: boolv7.39 (RLS) — ALTER TABLE … ENABLE ROW LEVEL SECURITY
(PG pg_class.relrowsecurity). Fresh table = false.
force_row_security: boolv7.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
impl TableSchema
pub fn column_position(&self, name: &str) -> Option<usize>
Source§impl TableSchema
impl TableSchema
Trait Implementations§
Source§impl Clone for TableSchema
impl Clone for TableSchema
Source§fn clone(&self) -> TableSchema
fn clone(&self) -> TableSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more