#[non_exhaustive]pub enum CastError {
Show 22 variants
InvalidInputSyntax(PgType),
ValueOutOfRange(PgType),
OutOfRange(PgType),
CannotConvertNaN(PgType),
CannotConvertInfinity(PgType),
NumericFieldOverflow,
NumericFormatOverflow,
DateTimeFieldOutOfRange,
DateOutOfRange,
TimestampOutOfRange,
DateOutOfRangeForTimestamp,
TimeZoneDisplacementOutOfRange,
CannotCast {
from: PgType,
to: PgType,
},
CannotCastJsonb {
from: JsonbKind,
to: PgType,
},
Jsonb(JsonbError),
MalformedArrayLiteral,
ArrayDimensionsExceeded,
UpperBoundLessThanLower,
ArrayUpperBoundTooLarge(i32),
ArraySizeExceeded,
ArrayBoundOutOfRange,
Unsupported,
}Expand description
Why PostgreSQL refuses a cast, one variant per message it raises, or why this crate declines to answer for it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidInputSyntax(PgType)
Text the target’s input function cannot read.
ValueOutOfRange(PgType)
Text the integer input function reads as a number beyond the type.
OutOfRange(PgType)
A value the cast to an integer type finds beyond the type.
CannotConvertNaN(PgType)
A NaN cast to an integer type.
CannotConvertInfinity(PgType)
An infinite numeric cast to an integer type.
NumericFieldOverflow
A value beyond the precision of numeric(p, s) after rounding to its scale, or an
infinity cast to it.
NumericFormatOverflow
A numeric beyond the weight or display scale PostgreSQL stores.
DateTimeFieldOutOfRange
A year, month or day no calendar has.
DateOutOfRange
A date before 4714-11-24 BC.
TimestampOutOfRange
A timestamp before 4714-11-24 BC.
DateOutOfRangeForTimestamp
A date from 294277-01-01 cast to timestamp.
TimeZoneDisplacementOutOfRange
An offset of 16 hours or more, or with minutes or seconds of 60 or more.
CannotCast
A value of a type with no cast to the target.
CannotCastJsonb
A jsonb of a kind the cast to a scalar type cannot take, a null aside, which casts
to NULL.
Jsonb(JsonbError)
Text jsonb_in cannot read, any number in it aside, whose refusal is numeric_in’s.
MalformedArrayLiteral
An array literal array_in cannot read.
ArrayDimensionsExceeded
An array of more than 6 dimensions.
UpperBoundLessThanLower
A specified dimension whose upper bound is less than its lower bound.
ArrayUpperBoundTooLarge(i32)
A specified dimension whose upper bound is 2147483647.
ArraySizeExceeded
An array whose size overflows int32 arithmetic.
ArrayBoundOutOfRange
A dimension bound i32 cannot hold.
Unsupported
A literal or cast this crate does not model. A date or timestamp is read only in the
spellings PgDate::parse and PgTimestamp::parse read, and a timestamptz only
with its offset, since without one the session’s TimeZone decides the instant. For the
same reason no cast between timestamptz and date, timestamp or a character type is
modelled.
Trait Implementations§
impl Copy for CastError
impl Eq for CastError
Source§impl Error for CastError
impl Error for CastError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()