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: u32The OID of the table.
name: StringThe 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: usizeThe 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: boolTrue 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: boolTrue 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: usizeThe 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
impl Write
Sourcepub fn keeps_written(&self) -> bool
pub fn keeps_written(&self) -> bool
True when the write keeps the rows that it wrote, for RETURNING or for Write::view_check.