Expand description
v6.3.3 — Describe statement pre-Execute.
Given a Statement returned by Engine::prepare(), compute
(parameter_oids, output_columns) without executing the
statement.
Implementation policy:
parameter_oids: count distinct$Nplaceholders in the AST and return a Vecof zeros (oid=0 = “let the server infer at Bind time”). PG drivers happily accept this. output_columns: resolve the FROM namespace — table, view, CTE, derived table, and every joined relation — then describe each SELECT item against it. Anything that cannot be resolved collapses the whole list to empty, which the pgwire layer maps to aNoDatareply.
v7.39 (round 462) — “complex shapes degrade to NoData, which drivers tolerate” was wrong, and the cost was silent.
Execute never sends a RowDescription (Describe owns it), so a
shape Describe cannot resolve reaches an extended-protocol client
as data rows with NO column metadata at all. Measured against
PG18 over sqlx: a view, a JOIN, a derived table, a UNION, a CTE
and every system catalog view all declared zero columns, so
row.get(0) was out of bounds on rows that plainly carried
values. Only a bare single-table SELECT worked. PG18 declares all
of them.
Describe and execution must therefore agree by construction —
[crate::tests] pins the two against each other over a shape
corpus so a future shape cannot drift the way views did.
Functions§
- describe_
prepared - One-shot describe of a prepared
Statement.