Fixes for binary protocol array handling#3494
Merged
Conversation
Fixes a bug when binary format. We must specify both: - the number of result column format codes - the result column format codes The text format case was working by accident. When using text format, the intention was to set the format code to 0. Instead, we set the number of result column format codes was set to 0. This is valid because it indicates that all result columns should use the default format (text). When using binary format, the intention was to set the format code to 1. Instead, we set the number of result column format codes to 1. Importantly, we never set a result column format code. This caused an error: 'insufficient data left in message'. We now always set the number of result column format codes to '1'. The value of '1' has special meaning: > or one, in which case the specified format code is applied to all result columns (if any) We then set a single column format code based on whether the connection (or query) is set to binary. Fixes #3487
Deploying node-postgres with
|
| Latest commit: |
f63b23b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c08f83cf.node-postgres.pages.dev |
| Branch Preview URL: | https://push-nnlqqononklk.node-postgres.pages.dev |
The call to parseArray was not working as expected because the value was being sent as a string instead of a Buffer. The binary parsers in pg-types all assume the incoming value is a Buffer.
Owner
|
ohh nice is this a fix #3487? |
Collaborator
Author
|
The first commit fixes the reported error in #3487. I annotated that in the first commit, but it seems like Github did not pick it up. While fixing the reported issue, I discovered that the binary array handling was not working. So, the second commit fixes that. I can split this into two commits if that is easier as well. |
Owner
one is totally fine! |
Owner
|
@hjr3 you're the best! 🫶 |
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.
No description provided.