Commit 98c8a37
committed
fix(pgwire): infer column-backed placeholder parameter types from catalog
Extend $N placeholder type inference beyond catalog-free forms (LIMIT/
OFFSET, casts) to catalog-backed positions such as `WHERE col = $1`,
`IN (...)`, `BETWEEN`, and `SET col = $N`, so a bare parameterised
query with no prepare_typed and no cast resolves its parameter type
instead of describing it as unknown. The resolved type carries the
column's declared integer width so an INT column reports int4 rather
than collapsing to int8.
Split placeholder_types.rs into a directory (catalog_free, column_backed,
scope, slots, infer) now that inference spans multiple resolution
strategies sharing a scope-tracking context. Also bound the shared
placeholder scanner's accepted $N index to the pgwire wire format's
Int16 ceiling, so a hostile index that parses as a usize but exceeds
what any conforming client could send is left untracked rather than
propagated to callers that size a Vec off it.1 parent 210d634 commit 98c8a37
14 files changed
Lines changed: 1721 additions & 537 deletions
File tree
- nodedb-sql/src
- placeholder_types
- nodedb
- src/control/server
- pgwire/handler
- prepared
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
0 commit comments