Skip to main content

Write

Struct Write 

Source
pub struct Write {
Show 17 fields pub kind: WriteKind, pub table: u32, pub name: String, pub alias: Option<String>, pub width: usize, pub checks: Vec<String>, pub unique: Vec<Unique>, pub returning: Option<Box<Query>>, pub foreign: Vec<Foreign>, pub on_conflict: Option<OnConflict>, pub merge: Option<Merge>, pub recheck: Option<Box<Query>>, pub updated: Vec<i16>, pub instead: bool, pub inherit: bool, pub view_check: Option<ViewCheck>, pub views: usize,
}
Expand description

The table that an INSERT, an UPDATE or a DELETE writes.

The rows of the query of an INSERT are the new rows, each with the conditions of the check constraints after the columns. The rows of an UPDATE are the same, with the ID of the version of the old row at the end. The rows of a DELETE have only the ID of the version of the row.

Fields§

§kind: WriteKind§table: u32

The OID of the table.

§name: String

The name of the table, for the errors of the constraints.

§alias: Option<String>

The alias of the target table of an INSERT, as INSERT INTO t AS a, which EXPLAIN shows.

§width: usize

The number of columns of the table. The first targets of the query are the columns. For a DELETE it is 0.

§checks: Vec<String>

The names of the check constraints in the order of their names. The targets after the columns are the conditions of these constraints, in the same order.

§unique: Vec<Unique>

The unique indexes of the table in the order of their OIDs, as RelationGetIndexList gives them. Each new version of a row must have a key that no other version has.

§returning: Option<Box<Query>>

The query of RETURNING, which reads one relation: the rows that the statement writes. Each row has the columns of the table, then the values that the query of the statement carries for it. For an UPDATE and a DELETE the carried values come after the columns and the conditions in each row of the query of the statement, before the ID of the version.

§foreign: Vec<Foreign>

The foreign keys that the write checks after the statement, in the order of the names of their triggers.

§on_conflict: Option<OnConflict>

The ON CONFLICT clause of an INSERT.

§merge: Option<Merge>

The clauses of a MERGE.

§recheck: Option<Box<Query>>

The query of the checks of the constraints after the triggers BEFORE ... FOR EACH ROW of an INSERT or an UPDATE, which can change the new row. It reads one relation, the new row, and gives its columns, then the conditions of the check constraints. When the write has it, Write::checks are not checked in the run of the plan: the rows of the run keep the conditions after the columns, and the caller checks the rows after the triggers.

§updated: Vec<i16>

The numbers of the columns that SET of an UPDATE or of ON CONFLICT DO UPDATE gives, in the order of the list, for the triggers of UPDATE OF. For a MERGE they are the columns of the SET of all its clauses UPDATE, as transformMergeStmt puts them in updatedCols.

§instead: bool

True for a write into a view with a trigger INSTEAD OF ... FOR EACH ROW for the event. The rows of the query go to the triggers, not to the heap, and the rows of an UPDATE and of a DELETE end with the old row of the view in place of the ID of the version.

§inherit: bool

True for an UPDATE, a DELETE or a MERGE of a table with children of INHERITS, with no ONLY, as expand_inherited_rtentry adds the children. Each row of the query gives the OID of its table before the ID of its version, and each table of the tree checks and changes its rows, as the leaves of a partitioned table do.

§view_check: Option<ViewCheck>

The checks of WITH CHECK OPTION of the views of an INSERT or an UPDATE of an automatically updatable view.

§views: usize

The number of automatically updatable views that the statement writes through. rewriteTargetView keeps the entry of each view in the range table and adds the entry of the relation under it.

Implementations§

Source§

impl Write

Source

pub fn keeps_written(&self) -> bool

True when the write keeps the rows that it wrote, for RETURNING or for Write::view_check.

Trait Implementations§

Source§

impl Clone for Write

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 Write

Source§

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

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

impl PartialEq for Write

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 Write

Auto Trait Implementations§

§

impl Freeze for Write

§

impl RefUnwindSafe for Write

§

impl Send for Write

§

impl Sync for Write

§

impl Unpin for Write

§

impl UnsafeUnpin for Write

§

impl UnwindSafe for Write

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.