Skip to main content

PartitionRole

Enum PartitionRole 

Source
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

§key_column_positions: Vec<usize>

父表 columns 中 key 列的下标(单列 v7.37.6-B, Vec 为将来扩多列预留)。

§index_template_sources: Vec<String>

CREATE INDEX ON parent (…) 的 Display-form 源串。 child 创建时再 parse + 在 child 上 execute,这样 future child 也自动继承父表索引。fan-out 实施在引擎层。

§

Range

Fields

§parent_name: String
§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)。

Fields

§parent_name: String
§

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)。

Fields

§parent_names: Vec<String>
§

Hash

v7.37.16 (16.2) — HASH child:行属于本 child iff pg_compatible_hash(key) mod modulus == remainder。 PG 强制 0 ≤ remainder < modulus;parser/DDL 层先 gate。

Fields

§parent_name: String
§modulus: u32
§remainder: u32
§

Default

Fields

§parent_name: String

Trait Implementations§

Source§

impl Clone for PartitionRole

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for PartitionRole

Source§

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

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

impl Eq for PartitionRole

Source§

impl PartialEq for PartitionRole

Source§

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

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.