Skip to main content

Module change

Module change 

Source
Expand description

Statements that alter data, and every ceiling that guards them.

§The ceiling on affected rows is checked before the change, always

The obvious implementation runs the change inside an atomic block, counts what it touched and undoes the block when the count is too high. That works only while a block exists, and a statement that defines an object confirms itself on this server, so no block can undo it. Worse, without a block there is nothing to undo at all, which is precisely when a caller most needs a ceiling.

So the count is derived from the statement’s own restriction by crate::exec::plan::estimate, run first, and the change is refused before it is sent. That costs one extra round trip on every change. The cost was accepted deliberately, because a ceiling that only works inside a block is a ceiling that fails in the case it exists for.

When no count can be derived, the answer declares a gap rather than pretending the ceiling was applied.

§A table with no unique key

A row of such a table cannot be named again afterwards, so the change cannot be repeated safely. That makes a repeat unsafe; it does not make this change wrong. The absence is therefore reported on the auxiliary channel and the change proceeds, unless sql.require_unique_key asks for the stricter rule.

Structs§

ChangeOutcome
What one change produced.

Functions§

admit_scale
Decides, before the change is sent, whether the ceiling admits it.
apply
Puts one change through every ceiling that guards it, then applies it.
conditions
Every condition the server reported for the statement, not only the first.
describe
Describes what one change did, with any notice the invocation earned.
has_unique_key
Whether the target table can name a row again afterwards.
note_session_is_ephemeral
Raises the notice about session state on an answer that carries none.
over_ceiling
The refusal a change over the ceiling produces, before it is sent.
refuse_without_restriction
Refuses a change that would reach every row of its table.
report_missing_unique_key
Applies the rule for a table that cannot name its rows again.
send
Sends one change and reads back everything the server said about it.
with_conditions
Attaches every condition beyond the first to a failure.