cockroach: Index | Files

package schemachange

import ""


Package Files

alter_column_type.go columnconversionkind_string.go

type ColumnConversionKind Uses

type ColumnConversionKind int

ColumnConversionKind represents "how hard" a semantic type conversion will be. TODO(bob): Should this be a type hierarchy to support conversion planning?

const (
    // ColumnConversionDangerous indicates that we could effect a type
    // conversion via built-in cast methods, but that the semantics are
    // not well-defined enough that a user would want to rely on this.
    // The use of this value should be accompanied by a link to an issue
    // to follow up.
    ColumnConversionDangerous ColumnConversionKind = iota - 1
    // ColumnConversionImpossible indicates that it is not possible to
    // effect the desired type conversion.  Additional information will
    // be present in the error returned from ClassifyConversion.
    // ColumnConversionTrivial indicates that a conversion is
    // byte-for-byte compatible with existing data and there is no
    // possibility of introducing a constraint validation error.
    // This would include conversions such as STRING -> BYTES, or
    // a change in which only the visible type of a column is changing.
    // ColumnConversionValidate indicates that a conversion is
    // byte-for-byte compatible with existing data, but that we need
    // to validate the existing data against the new rule.
    // This would include BYTE -> STRING, where we need to validate
    // that all of the existing bytes are valid UTF-8 sequences.
    // ColumnConversionGeneral indicates that we will end up rewriting
    // the existing data into a new format.

These columnConversionKinds are ordered from easiest to hardest.

func ClassifyConversion Uses

func ClassifyConversion(
    ctx context.Context, oldType *types.T, newType *types.T,
) (ColumnConversionKind, error)

ClassifyConversion takes two ColumnTypes and determines "how hard" the conversion is. Note that this function will return ColumnConversionTrivial if the two types are equal.

func (ColumnConversionKind) String Uses

func (i ColumnConversionKind) String() string

Package schemachange imports 6 packages (graph) and is imported by 2 packages. Updated 2020-08-05. Refresh now. Tools for package owners.