Repository navigation
feat(pg): support ArrayBuffer query parameters - #3857
Open
Aschenbath wants to merge 1 commit into
Open
Aschenbath wants to merge 1 commit into
Aschenbath wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An ArrayBuffer passed as a query parameter is currently JSON-stringified to {} instead of sending its bytes. Convert genuine ArrayBuffers to Buffer values, including buffers from another realm and buffers returned by a scalar toPostgres() hook. Serialize ArrayBuffers inside PostgreSQL arrays using the existing binary hex representation. Fixes #3323.
This lets a caller send one packed buffer containing metadata and floating-point payload views directly to a BYTEA column. Existing typed-array and DataView parameters retain their byte offset and length. The parameter-conversion documentation now describes both forms.
Validation on Node 24.22.1 and PostgreSQL 17.11 with SSL:
Native scalar ArrayBuffer parameters have the same behavior as existing Buffer parameters. The pre-existing libpq limitation in #980 still affects arbitrary binary scalar values, including NUL bytes; this change does not claim to fix that transport limitation. Arbitrary binary payloads were verified with the JavaScript and Cloudflare clients, and binary arrays with both JavaScript and native clients.
Implemented with OpenAI Codex and independently reviewed by a separate Codex agent; no human review is claimed.