Skip to main content

Module binding

Module binding 

Source
Expand description

Static relational row-type binding.

This module derives source and query output schemas from plans, catalog declarations, and already-bound CTE schemas. It never executes a query or samples a result row, so empty, spilled, and correlated relations retain the same declared PostgreSQL type identities as non-empty relations.

Re-exports§

pub use context::BindingContext;

Modules§

catalog_sources
Engine-independent catalog source binding.
context
Immutable SQL inputs adapted from the active statement scope.
correlation
Physical-plan correlation analysis for scalar subquery initialization.
portals
Cursor binding and dependency metadata consumed before snapshot registration.
scoped_types
Catalog-backed function and scalar-subquery typing within an owned analysis scope.
snapshot
Owned catalog and CTE type inputs for analysis that rewrites nested scopes.
statements
Executable statement schemas and mutation parameter analysis.
stored_columns
Stored statement column identities, durable source shapes, and rewrite-rule binding.
stored_relations
Bind durable statement relations while preserving namespace, catalog, and error ordering.
stored_routines
Exact routine binding for catalog-owned statements.
stored_types
Stored plans and stored syntax record the user-defined types they cast to by OID identity, as PostgreSQL stores type OIDs, so a rename, a schema move or another search path cannot change which type they mean.
syntax_sites
Bound copies of stored syntax, read back in the order of that syntax. Catalog-owned expressions and statements are stored as syntax and bound by lowering a copy; binding keeps the copy’s shape, so reading the lowered copy and its bound form side by side, in the order the stored syntax visitor walks the syntax, pairs every routine call, cast and unknown literal with the syntax node it came from. The lowered copy tells which bound nodes stand for syntax literals: variable binding may replace column references by typed placeholders, which are not syntax.
view_dependencies
Stored-view relation and sequence binding/dependency analysis.

Structs§

RoutineParameterScope
The parameters a SQL routine’s body can name, in positional order.

Enums§

VariableSiteResolution
How a name that a PL/pgSQL variable takes resolves in the statement it appears in.

Functions§

analyze_column_type_transform
Analyze a USING expression against the original table row type before the ALTER target or its new type is checked. Transform expressions admit no parameters or query-valued descendants; input functions run during analysis and runtime expressions stay deferred.
analyze_expression_plan_type
Validate a command argument’s names and types without running its expressions.
analyze_prepared_command_schema
analyze_projection_output_schema
Derive and validate a projection’s exact output row type without executing it.
analyze_query_plan_schema
Analyze every catalog and scalar reference and derive the exact output row type without executing the query.
analyze_query_plan_schema_with_catalog
analyze_recursive_control_step
analyze_source_plan_schema
Derive and validate one FROM source’s exact row type without executing it.
bind_expression_plan_routines_for_storage
Bind every routine call owned by a stored scalar expression and validate its complete query-valued descendants against the expression’s row scope. The plan keeps the shape of the syntax it was lowered from.
bind_expression_plan_type
Derive the declared SQL type of a standalone expression plan without executing it. The plan-owned subquery arena participates in type resolution so scalar subqueries retain their projected type at command boundaries such as CALL.
bind_projection_output_schema
Bind a projection against an already-declared input schema. star_schema identifies the relation expanded by bare *; expression_schema may also contain joined sources and hidden lookup aliases used by scalar expressions.
bind_query_plan_routines_for_storage
bind_query_plan_schema
Derive the exact output row type of a query plan without executing it.
bind_routine_parameter_references
Resolve the names in one statement of a SQL routine’s body that refer to the routine’s parameters, against the catalog that ctes describes, as PostgreSQL’s parser resolves them with the hooks sql_fn_parser_setup installs. The routine calls the statement makes are left to its analysis.
bind_source_plan_schema
Derive the exact row type of one FROM source without executing it.
bind_source_plan_schema_for_execution
Bind every table-function source in one execution-owned source plan to its exact routine identity and return the schema derived from those same bindings.
bind_syntax_query_plan_routines
Bind a copy of a query lowered from stored syntax, keeping its shape so every bound identity can be carried back to that syntax.
extend_cte_generated_schema
hide_recursive_generated_schema
infer_prepared_parameter_types
overlay_outer_schema
resolve_variable_sites
Find how each variable site of a PL/pgSQL statement resolves in the statement. plan is the statement with each name that the function’s variables take replaced by the positional parameter whose number is the site’s, typed by params, and names holds those names as written, in site order.
validate_query_block_expression_types
Validate every scalar expression in a query block while the physical input still carries declared SQL types. This must precede polymorphic rewrites such as pg_typeof, because an invalid common type is an error, not an unknown result.
validate_query_block_references
Validate every query-block reference only after the caller has the authoritative source schema. This preserves registered table-function row shapes and checks recursive argument references before definitive routine namespace lookup. schema holds the block’s columns over outer, the scope of the queries that enclose the block.
values_types_in_scope
with_query_table_pseudo_columns
Add query-block pseudo columns after the complete source scope is known, so _meta is exposed only for one unambiguous local-table source and never shadows a real relation alias.