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
PostgreSQLstores 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
unknownliteral 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§
- Routine
Parameter Scope - The parameters a SQL routine’s body can name, in positional order.
Enums§
- Variable
Site Resolution - How a name that a
PL/pgSQLvariable 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_schemaidentifies the relation expanded by bare*;expression_schemamay 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
ctesdescribes, asPostgreSQL’s parser resolves them with the hookssql_fn_parser_setupinstalls. 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/pgSQLstatement resolves in the statement.planis the statement with each name that the function’s variables take replaced by the positional parameter whose number is the site’s, typed byparams, andnamesholds 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 anunknownresult. - 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.
schemaholds the block’s columns overouter, 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
_metais exposed only for one unambiguous local-table source and never shadows a real relation alias.