Skip to main content

Module type_resolution

Module type_resolution 

Source
Expand description

Static SQL type propagation and PostgreSQL-compatible common-type rules.

Re-exports§

pub use common::common_context_expression_type;
pub use common::common_type;
pub use common::common_type_in;
pub use common::select_common_input_type;
pub use common::values_column_types;
pub use common::CommonTypeContext;

Modules§

composite_rows
Store typed ROW constructors with attribute positions chosen by their original analysis.

Structs§

BuiltinFunctionOverload
CastCatalogEntry
MatchedRoutineSignature
A fully matched call signature. Declared identity is kept separate from expansion-aware call binding.
ResolvedFunctionOverload
RoutineCallDescriptor
Call-site information that is independent from the routine’s declared identity.
RoutineCoercionTarget
One supplied argument’s concrete coercion destination.
RoutineParameterDescriptor
One declared input or output parameter participating in routine-call matching.
RoutineTypeSubstitutions
Concrete substitutions shared by input, return, and output pseudo-types.

Enums§

CastMethod
A PostgreSQL cast’s implementation, separate from its value conversion.
CommonTypeContext
The construct selecting a common type, as select_common_type and coerce_to_common_type name it in their diagnostics.
RoutinePolymorphicFamily
RoutinePolymorphicType
PostgreSQL’s supported polymorphic pseudo-type spellings.
RoutineSignatureMatchError
A structural or polymorphic-resolution error that must be distinguished from an ordinary non-matching candidate.
RoutineVariadicMode
RoutineVariadicPlan
Execution plan for the declared variadic array parameter.

Traits§

FunctionTypeResolver

Functions§

ambiguous_binary_operator
oper_select_candidate found more than one candidate for the operand types, as '1' + '2' does among the arithmetic operators.
ambiguous_prefix_operator
oper_select_candidate found more than one candidate for a prefix operator’s operand, as -'1' does among the numeric and interval negations.
assignment_source_type
The type of an assignment’s source before coercion to its destination. A bare string or NULL literal has none: transformAssignedExpr and transformAssignmentIndirection convert it with the destination type’s input function instead of checking a source type, so '7' assigns to an integer array element and 'abc' fails as integer input.
assignment_type_compatible
Whether PostgreSQL assignment coercion accepts the declared source and target. Domains use their base type for cast selection and retain constraint checking at the value conversion boundary; array coercion applies element by element.
bind_type_introspection
Bind polymorphic type-introspection calls and common-type coercions while the input schema still carries declared SQL types.
bind_type_introspection_with_control
Bind an admitted scalar tree while every new type name, cast and selected-call allocation remains under the original tree’s allowance and both cancellation scopes.
bind_type_introspection_with_resolver
Bind type-introspection calls with access to catalog-backed function and aggregate overloads.
builtin_function_argument_targets
Return the declared argument targets selected by PostgreSQL-compatible built-in resolution. Known argument types are retained for polymorphic calls, while fixed signatures and overloaded operators supply the context needed to resolve unknown arguments.
builtin_function_type
builtin_function_type_with_resolver
Type a built-in call whose arguments may name catalog types, such as casts to domains and enums.
cast_catalog_entry
Return the same cast identity used by static coercion compatibility.
cast_volatility
Volatility of evaluating source::target at run time. A literal of unknown type is converted during parse analysis instead and adds no run-time call.
catalog_input_type
Whether a type’s input function consults the catalog: the OID alias types and aclitem look names up, and an enum, a composite type, a record or a type known by name is read through its catalog definition. Analysis without the catalog leaves such a literal in the cast form that binding or evaluation reads, and reads every other literal with the type’s input function.
coerce_common_context_value
common_context_expression_type
Resolve an expression participating in PostgreSQL’s common-type selection. Bare string and NULL literals retain the parser’s unknown type until the surrounding VALUES, set operation, CASE, or array context selects a concrete type.
common_context_type_with_control
Preserve unknown-literal and domain rules when selecting an operator’s common type without a catalog callback.
common_type
common_type_in
The common type of left and right for the construct context, which reports a conflict as select_common_type and coerce_to_common_type report it: 42804 when the types are of different categories and 42846 when the other type has no implicit cast to the selected one.
contains_unknown_literal
Whether an expression has an unknown literal outside its subqueries, the only nodes that binding converts to enum constants.
equality_operand_type
equality_operand_type_with_control
Preserve the existing equality coercion rules while retaining any copied type payload under the caller’s allowance.
explicit_type_compatible
Whether an explicit SQL cast has a PostgreSQL coercion path, independently of its value. NULL input does not make an otherwise missing cast valid.
fold_stored_enum_constants
Replace every unknown literal that binding coerces to an enum, an enum array or a domain over one by the constant binding produced for it. Returns whether any literal changed.
foreign_key_operand_type
Resolve the comparison type accepted by a PostgreSQL foreign key. The referenced key’s operator class makes compatibility directional: an implicit cast from the referencing type to the referenced type is valid, while the reverse cast alone is not. Integer widths, floating widths, character strings, and date/timestamp types additionally have cross-type equality operators in their shared operator families.
is_unknown_literal
A bare string or NULL literal, which PostgreSQL types as unknown until its context resolves it.
match_routine_signature
Match one selected signature and require its defaults to have consistent types.
range_frame_offset_type
The type a RANGE frame offset of type offset (None for an unknown literal or parameter) is coerced to when the frame is ordered by a column of type order (None when the key is itself unknown, which sorts as text). An offset of the exact type of one support function selects it; an unknown offset prefers the ordering type; any other offset must coerce implicitly to exactly one support function’s type.
resolve_alter_column_type
Resolve an ALTER declaration after its relation and column checks. The compiler keeps modifier syntax intact until this boundary, including declarations an IF NOT EXISTS action can skip.
resolve_declared_column_type
routine_polymorphic_type
Parse a routine pseudo-type after applying the same spelling normalization as routine identity matching.
scalar_cast_source_type_name_with_control
Casts retain a source domain’s identity so an identity cast cannot re-run its constraints. Operator consumers continue to use the underlying type.
scalar_integer_operation_width
scalar_integer_operation_width_with_control
Select the existing arithmetic width from borrowed IR and schema metadata without constructing an untracked inferred type or name.
scalar_operand_type_name
scalar_operand_type_name_with_control
Preserve explicit binding and domain precedence while admitting inferred types and their emitted names. Optional semantic inference failures remain absent; resource failures propagate to the original caller.
scalar_record_field_type_with_control
Retain a ROW field’s analyzed SQL identity before its scalar carrier erases widths and typed NULLs. Only syntax that PostgreSQL leaves unknown receives the unknown OID.
scalar_type
scalar_type_with_control
Infer a scalar type from borrowed schema and parameter metadata while retaining every constructed type and temporary buffer under the supplied allowance.
scalar_type_with_resolver
select_common_input_type
select_common_input_type_with_control without production limits.
store_operand_coercions
Store the conversions selected for operator operands, function arguments and CASE result arms, as PostgreSQL stores analyzed casts and typed constants. Each operand keeps its operator’s declared input type, including numeric conversions, array coercions and domain-to-base relabels. Runtime annotations of an unchanged carrier type do not become stored SQL casts. Catalog input constants keep their cast for identity binding; other unknown literals retain the selected input function’s typed value. Returns whether anything changed.
stored_enum_constant
The stored form of an enum constant: its label-identity value under the type’s OID identity. The type is resolved from the identity when the expression is bound, so no cached name can go stale.
undefined_binary_operator
operator does not exist for a binary operator; None is an operand of type unknown.
undefined_binary_operator_named
undefined_binary_operator with operand type names already spelled.
undefined_prefix_operator
operator does not exist for a prefix operator.
validate_catalog_literals
Convert the unknown literals that binding coerces to catalog enum types, reporting the first invalid input as PostgreSQL parse analysis does. Binding at execution then folds the same literals without failing.
values_column_types