You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom binary parameters work individually but fail inside bytea arrays #3872
With pg 8.23.1 at 2a5850fb0db18f5e40a642bbb4a4743de412ab54, a custom value returning a Buffer from toPostgres() works as a scalar parameter but throws inside an array:
constvalue={toPostgres: ()=>Buffer.from([0,128,255])}awaitclient.query('SELECT $1::bytea AS value',[value])// worksawaitclient.query('SELECT $1::bytea[] AS value',[[value]])// TypeError: elementRepresentation.replace is not a function
The same applies when the hook returns a typed-array view or DataView. Array elements are documented to follow the same recursive conversion rules. The array fallback currently passes the prepared Buffer to string escaping instead of its existing binary encoder.
Observed on macOS, Node v25.9.0, PostgreSQL 18.1. This concerns existing Buffer/view conversion; it is separate from nullish hook results (#3845), new ArrayBuffer support (#3857), and named-statement recovery after a serialization error (#3867).
Investigated and verified with OpenAI Codex under the account owner's authorization.
Environment: Node 25.9.0, PostgreSQL 18.1, macOS arm64. Codex reproduced this with a local PostgreSQL instance and prepared this report.
Activity