Skip to main content

EvolutionAnswers

Struct EvolutionAnswers 

Source
#[non_exhaustive]
pub struct EvolutionAnswers { pub parameterized_string_widening_is_lossless: bool, pub nested_field_addition_is_lossless: bool, pub drops_a_column_in_place_before_an_index_column: bool, }
Expand description

What this engine keeps through a change to a table that already holds rows.

Every answer defaults to false, which means nothing has been measured rather than this engine loses data. Razeri’s classifier treats a change it cannot prove keeps every value as one that does not, so a silence here costs an operator a warning they can read and never costs them a row.

An answer only ever makes a verdict gentler. Razeri proves what it can from the types themselves first; these answers are asked afterwards, about the changes the engine’s own spelling left unprovable.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§parameterized_string_widening_is_lossless: bool

This engine widens a string’s declared length in place, keeping every value.

A column declared varchar(10) and now declared varchar(40) holds a strict superset of what it held, as a type. Whether the engine gets it there without rewriting the column is the engine’s own business, and this is where it says so.

The question is asked at all because a length is spelled differently on every engine — VARCHAR(40) on one, STRING(40) on another, NVARCHAR(40) on a third — and the length in a spelling Razeri does not write is a length Razeri cannot read back. A true here is the dialect saying “that pair is a widening on my engine, and nothing is lost”.

§nested_field_addition_is_lossless: bool

This engine adds a field to a record a table already holds, keeping every value.

The change is a record column that gained a field and changed in no other way. Some engines take it as a change to the column’s declared shape and keep every row; others have no way to make it at all, and the column has to be rebuilt.

false is the careful answer, and it is the right one for every engine that has no records to begin with.

§drops_a_column_in_place_before_an_index_column: bool

This engine drops a column where the table stands, even when a column of one of the table’s indexes comes after it.

Most engines do, and the answer defaults to true: unlike the two answers above, the careful answer here is the plain drop, because an engine that cannot make it refuses it with nothing changed. One engine has been measured to refuse — DuckDB: “Cannot drop this column: an index depends on a column after it!”, and a table’s key is such an index. Answer false for an engine like it, and Razeri rebuilds such a table instead: renamed aside, made again from the new design’s CREATE, every row copied across, the old one dropped.

Implementations§

Source§

impl EvolutionAnswers

Source

pub const fn none() -> Self

Nothing measured — the answer for an engine nobody has asked.

Source

pub const fn widening_a_string_in_place() -> Self

This engine widens a string’s declared length in place. See EvolutionAnswers::parameterized_string_widening_is_lossless.

Source

pub const fn and_a_nested_field(self) -> Self

The same answers with the nested-field one added, so an engine that keeps both states both without a constructor per pair.

Source

pub const fn but_no_drop_before_an_index_column(self) -> Self

The same answers, for an engine that cannot drop a column that comes before a column of one of the table’s indexes. See EvolutionAnswers::drops_a_column_in_place_before_an_index_column.

Trait Implementations§

Source§

impl Clone for EvolutionAnswers

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 Copy for EvolutionAnswers

Source§

impl Debug for EvolutionAnswers

Source§

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

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

impl Default for EvolutionAnswers

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for EvolutionAnswers

Source§

impl PartialEq for EvolutionAnswers

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 EvolutionAnswers

Auto Trait Implementations§

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.