Skip to content

Commit 210d634

Browse files
committed
fix(pgwire): infer parameter types from SQL text on prepare
Server-inferred parameter types previously came only from DataFusion plan analysis, which leaves positions like `LIMIT $1`/`OFFSET $1` and explicit casts (`$1::BIGINT`) undescribed when the client sends no declared oid. tokio-postgres then refuses to bind because the parameter's wire type is unknown. Add nodedb-sql::infer_placeholder_types to resolve a placeholder's type directly from the surrounding SQL, and use it to fill any parameter slot the client left undeclared, independent of whether the plan-analysis pass succeeds.
1 parent 752c4f0 commit 210d634

6 files changed

Lines changed: 764 additions & 12 deletions

File tree

nodedb-sql/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub mod functions;
2222
pub mod optimizer;
2323
pub mod params;
2424
pub mod parser;
25+
pub mod placeholder_types;
2526
pub mod planner;
2627
pub mod reserved;
2728
pub mod resolver;
@@ -39,6 +40,7 @@ pub use visitor::plan_visitor::args::*;
3940
pub use catalog::{SqlCatalog, SqlCatalogError};
4041
pub use error::{Result, SqlError};
4142
pub use params::ParamValue;
43+
pub use placeholder_types::infer_placeholder_types;
4244
pub use types::*;
4345

4446
/// Parse a standalone SQL expression string into an `SqlExpr`.

0 commit comments

Comments
 (0)