pub enum PartitionRole {
Parent {
kind: PartitionKind,
key_column_positions: Vec<usize>,
index_template_sources: Vec<String>,
},
Range {
parent_name: String,
lower: PartitionBound,
upper: PartitionBound,
},
List {
parent_name: String,
values: Vec<PartitionBound>,
},
Inherits {
parent_names: Vec<String>,
},
Hash {
parent_name: String,
modulus: u32,
remainder: u32,
},
Default {
parent_name: String,
},
}Expand description
v7.37.6-B — partition 三态(parent / range child / default child)。
Variants§
Parent
Fields
§
kind: PartitionKindRange
Fields
§
lower: PartitionBound半开区间下界(>=,SQL FROM (lower)).
§
upper: PartitionBound半开区间上界(<,SQL TO (upper)).
List
v7.37.16 (16.1) — LIST child:行属于本 child iff key ∈ values。
values 在 child 创建时从 SQL FOR VALUES IN (lit, …) 求值;
跟 PG 一样,显式 NULL ∈ values 由 caller 单独处理(不在
PartitionBound 内表达 NULL)。
Inherits
v7.39 (round 645) — PG 表继承的 CHILD:CREATE TABLE c (…) INHERITS (p1, p2)。跟分区 child 的三个本质区别(实测 PG18):
- 父表自己有行(分区父表永远空),所以父表的联合体要含自身;
INSERT INTO 父表不路由到 child(分区会路由);DROP TABLE 父表不带 CASCADE 报错(分区父表连子表一起删)。 多父继承合法,故parent_names是 Vec;pg_inherits.inhseqno正是父表在这个列表里的位置(1-based)。
Hash
v7.37.16 (16.2) — HASH child:行属于本 child iff
pg_compatible_hash(key) mod modulus == remainder。
PG 强制 0 ≤ remainder < modulus;parser/DDL 层先 gate。
Default
Trait Implementations§
Source§impl Clone for PartitionRole
impl Clone for PartitionRole
Source§fn clone(&self) -> PartitionRole
fn clone(&self) -> PartitionRole
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PartitionRole
impl Debug for PartitionRole
impl Eq for PartitionRole
Source§impl PartialEq for PartitionRole
impl PartialEq for PartitionRole
impl StructuralPartialEq for PartitionRole
Auto Trait Implementations§
impl Freeze for PartitionRole
impl RefUnwindSafe for PartitionRole
impl Send for PartitionRole
impl Sync for PartitionRole
impl Unpin for PartitionRole
impl UnsafeUnpin for PartitionRole
impl UnwindSafe for PartitionRole
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more