Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

pg 8.16.2 in binary mode produces incorrect row values

未关闭
#3,495 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@hjr3 已经在做这个了。

开始于 2025年6月20日。

评估

这个 Issue 还没有评估数据。

描述

bug

I have recently have been experimenting with pg's binary mode for performance reasons and tried the latest change, and I found that it delivers incorrect results sometimes for various non-string fields.
For example, a "int32" column with value "1000" is incorrectly returned as 1007.

This is caused by the parser converting the buffer slice into an utf8 string:
https://github.com/brianc/node-postgres/blob/1a25d128177dd7c54dc4652bbb92ac7986306e3f/packages/pg-protocol/src/parser.ts#L287

and then the result converts it back into a buffer in binary mode
https://github.com/brianc/node-postgres/blob/1a25d128177dd7c54dc4652bbb92ac7986306e3f/packages/pg/lib/result.js#L69-L70

This is incorrect, however, because roundtrips with random binary data from and to utf8, does not work all the time - for example the int32 value "1000" (0x3e8)

> Buffer.from(Buffer.from([0,0,0x03,0xe8]).toString())
<Buffer 00 00 03 ef bf bd>
> readInt32BE()
< 1007

I was able to fix this by performing the conversion the other way around, but this does not seem great performance-wise.

主要语言
JavaScript
星标
13.2k
派生
1.4k
平均合并
6 天 15 小时
30 天内合并 PR
6

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

brianc/node-postgres 的其他 Issue

查看 brianc/node-postgres 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。