Skip to main content

Relation

Struct Relation 

Source
pub struct Relation {
Show 22 fields pub oid: u32, pub file: u32, pub name: String, pub namespace: u32, pub kind: RelKind, pub owner: u32, pub row_type: u32, pub columns: Vec<Column>, pub has_index: bool, pub has_triggers: bool, pub toast: u32, pub index: Option<IndexInfo>, pub sequence: Option<SequenceInfo>, pub view: Option<ViewInfo>, pub options: Vec<String>, pub acl: Option<Vec<String>>, pub replica_identity: u8, pub unlogged: bool, pub partition_key: Option<PartitionKey>, pub partition_of: Option<PartitionOf>, pub inherits: Vec<u32>, pub of_type: u32,
}
Expand description

A relation: a table, an index, a sequence or a TOAST table.

Fields§

§oid: u32

The OID.

§file: u32

relfilenode of a relation with storage other than a sequence: the OID of the relation, and a new OID after a rebuild such as REINDEX. A sequence has its file in SequenceInfo::file.

§name: String

The name.

§namespace: u32

The OID of the schema.

§kind: RelKind

The kind.

§owner: u32

The OID of the owner role.

§row_type: u32

The OID of the row type, or 0 for an index or a sequence.

§columns: Vec<Column>

The columns, in the order of their numbers.

§has_index: bool

relhasindex: true after the first index on the table.

§has_triggers: bool

relhastriggers: true after the first foreign key that refers to the table or that the table has.

§toast: u32

reltoastrelid: the OID of the TOAST table, or 0.

§index: Option<IndexInfo>

The facts of an index.

§sequence: Option<SequenceInfo>

The facts of a sequence.

§view: Option<ViewInfo>

The query of a view.

§options: Vec<String>

reloptions: each option as name=value.

§acl: Option<Vec<String>>

relacl: the items of the aclitem[] value in their text form, or None for the default privileges of the owner.

§replica_identity: u8

relreplident: d, n, f or i, or 0 for the default of the kind of the relation.

§unlogged: bool

True when relpersistence is u. The rows of an unlogged table are kept as the rows of the other tables. A temporary relation has t because of its schema.

§partition_key: Option<PartitionKey>

The partition key of a partitioned table, one row of pg_partitioned_table.

§partition_of: Option<PartitionOf>

The parent table and the bound of a partition.

§inherits: Vec<u32>

The parent tables of INHERITS: the parent at index i has inhseqno i + 1. NO INHERIT leaves 0 in the place of the parent, so the other parents keep their numbers. A partition has its parent in Relation::partition_of.

§of_type: u32

reloftype: the composite type of a typed table, or 0.

Implementations§

Source§

impl Relation

Source

pub fn column_number(&self, name: &str) -> Option<i16>

The number of the column with the name, from 1.

Source

pub fn column(&self, number: i16) -> Option<&Column>

The column with the number, from 1.

Trait Implementations§

Source§

impl Clone for Relation

Source§

fn clone(&self) -> Self

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 Relation

Source§

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

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

impl Eq for Relation

Source§

impl PartialEq for Relation

Source§

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

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.