pub struct IrInsert {
pub guard: Option<IrExpr>,
pub target: IrSource,
pub assignments: Vec<(String, IrExpr)>,
pub unless_conflict: Option<IrConflict>,
pub rewrites: Vec<IrRewrite>,
pub returning: Vec<IrShapePointer>,
pub enqueue_vector: Vec<VectorEnqueueInfo>,
pub enqueue_search: Vec<SearchEnqueueInfo>,
pub multi_link_appends: Vec<IrMultiLinkMutation>,
pub id_default_sql: Option<String>,
pub nested_ctes: Vec<IrCteDef>,
}Fields§
§guard: Option<IrExpr>(insert …) if cond else {} — the condition, folded into the insert
itself. Guarding a reader would not do: the insert is a data-modifying
CTE, which Postgres runs whether or not anything reads it, so the row
would be written even when the condition is false.
target: IrSource§assignments: Vec<(String, IrExpr)>Each element is (column_name, value_expr).
unless_conflict: Option<IrConflict>§rewrites: Vec<IrRewrite>Schema-defined rewrites that override or augment the inserted columns.
returning: Vec<IrShapePointer>Shape to return after insert (for RETURNING clause).
enqueue_vector: Vec<VectorEnqueueInfo>Vector indexes on this type that need outbox rows written.
enqueue_search: Vec<SearchEnqueueInfo>OpenSearch-backed SearchIndexes that need outbox rows written.
multi_link_appends: Vec<IrMultiLinkMutation>tags := expr / tags += expr in the insert shape — populates the
junction table for a multi-link at creation time. Unlike IrUpdate,
there’s no clear/remove list: a brand-new row has no prior junction
rows to clear or remove from.
id_default_sql: Option<String>SQL for the target’s own id default, when the insert has to name the
id rather than let the column default supply it — a nested insert in a
for body, where the junction row must be paired with the row this
iteration inserted and RETURNING guarantees no order to pair on.
nested_ctes: Vec<IrCteDef>DML (INSERT/UPDATE/DELETE) discovered nested inside a link-assignment
value — author := (select (insert Person {...}) { id }) — hoisted
into its own WITH CTE ahead of this insert, since Postgres has no
way to run a nested INSERT inside a VALUES list otherwise. When
non-empty, the emitter switches this insert’s own row source from
VALUES (...) to SELECT ... FROM <cte>, ..., and any assignment
value referencing one of these CTEs is a plain ColumnRef to its
id column. See Compiler::compile_link_subquery.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IrInsert
impl RefUnwindSafe for IrInsert
impl Send for IrInsert
impl Sync for IrInsert
impl Unpin for IrInsert
impl UnsafeUnpin for IrInsert
impl UnwindSafe for IrInsert
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.