Expand description
Maintains a catalog of valid casts between mz_repr::SqlScalarTypes, as well as
other cast-related functions.
Macrosยง
- casts ๐
Structsยง
- Cast
Impl ๐ - The implementation of a cast.
- Cast
Template ๐ - A cast template is a function that produces a
Castgiven a concrete input and output type and a failure mode. A template can returnNoneto indicate that it is incapable of producing a cast for the specified types, or for the specified failure mode.
Enumsยง
- Cast
Context - Describes the context of a cast.
- Cast
Error - Error returned when a cast is not available or not allowed.
Constantsยง
- REG_
STRING_ ๐CAST_ TEMPLATE - STRING_
REG_ ๐CAST_ TEMPLATE - STRING to REG*
Staticsยง
- REGCLASS_
TO_ ๐STRING - REGPROC_
TO_ ๐STRING - REGTYPE_
TO_ ๐STRING - STRING_
TO_ ๐REGCLASS_ COERCED - STRING_
TO_ ๐REGCLASS_ EXPLICIT - STRING_
TO_ ๐REGPROC - STRING_
TO_ ๐REGTYPE - VALID_
CASTS ๐
Functionsยง
- can_
cast - Reports whether it is possible to perform a cast from the specified types.
- extract_
unary_ ๐stages_ for_ try_ cast - The unary functions a strict cast from
fromapplies to its input, innermost first, orNoneif the cast has any other shape. SeeCastTemplate::newfor the shape a cast must have. - get_
cast ๐ - Get casts directly between two
SqlScalarTypes, with control over the allowedCastContext. - guess_
best_ common_ type - Guesses the most-common type among a set of
SqlScalarTypes that all members can be cast to. ReturnsNoneif a common type cannot be deduced. - plan_
cast - Plans a cast between
SqlScalarTypes, specifying which types of casts are permitted usingCastContext. - plan_
cast_ with_ failure_ mode - Like
plan_cast, but with the given failure mode. UnderCastFailureMode::NullFallbackevery stage of the cast, including the intermediate string cast that string-like types route through, is wrapped so that a failure anywhere yields NULL. - plan_
coerce - plan_
coerce_ with_ failure_ mode - Like
plan_coerce, but the casts that coerce a literal tocoerce_touse the given failure mode.TRY_CAST('abc' AS int4)reaches its cast through this coercion, so the mode has to apply here too. - plan_
hypothetical_ cast - Similar to
plan_cast, but for situations where you only know the type of the input expression (from) and not the expression itself. The returned expression refers to the first column of some imaginary row, where the first column is assumed to have typefrom. - plan_
hypothetical_ cast_ with_ failure_ mode - Similar to
plan_hypothetical_cast, but with aCastFailureModeto specify behavior. - sql_
impl_ ๐cast - Like func::sql_impl_func, but for casts.
- sql_
impl_ ๐cast_ per_ context - to_
jsonb - Converts an expression to
SqlScalarType::Jsonb. - to_
string - Converts an expression to
SqlScalarType::String. - valid_
cast_ base_ type_ pairs - The base type pairs that have an entry in the cast table, for tests that want to prove they exercised every one.
- validate_
range_ ๐element_ type - Returns an error if the given type is not a supported range element type (PostgreSQL built-in range types: int32, int64, date, numeric, timestamp, timestamptz).
Type Aliasesยง
- Cast ๐
- A cast is a function that takes a
ScalarExprto anotherScalarExpr.