pub struct BoundDefault {
pub column: u16,
pub expr: BoundExpr,
}Expand description
A NOT NULL column’s DEFAULT, bound so a REPLACE can stand it in.
REPLACE’s rule for a NOT NULL violation is to substitute the column’s
default, and to fall back to ABORT only when there is no default. So
UPDATE OR REPLACE t SET c = NULL on c TEXT NOT NULL DEFAULT 'd' stores
'd', and this engine used to refuse the statement instead.
The write path cannot bind one for itself: a default is schema text, and by the time a row is being checked the parser is long out of scope. The binder already binds one for every column a statement omits; these are the same expressions bound for the columns it supplies, which is where a NULL that needs replacing can come from.
Only the columns that can need it are here - NOT NULL and with a default -
so an ordinary table carries an empty vector and the write path skips the
whole apparatus.
Fields§
§column: u16The column the default belongs to.
expr: BoundExprThe default expression, bound.