Subject: [pgjdbc/pgjdbc] PR #3760: fix: Issue #3757 PreparedStatement.toString fails for hex encoded bytea parameter

From: "davecramer (@davecramer)" <[email-masked]>
Date: Tue, 12 Aug 2025 10:20:56 +0000

One thing.

Do we really want to allow whitespace in the hex encoded parameter?

Also fixed the error message which had an `'` in it which stopped MessageFormat from formatting the message properly

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 12 Aug 2025 12:30:53 +0000

(on pgjdbc/src/main/java/org/postgresql/util/PGbytea.java)

This defeats Netty's approach. `Character.MAX_VALUE + 1` was vital there.
If you use `[256]`, then the reference to `Netty` is misleading.

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 12 Aug 2025 12:32:01 +0000

"netty" has nothing to do with whitespace

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 12 Aug 2025 12:32:50 +0000

I don't think it makes sense adding chars one by one

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Tue, 12 Aug 2025 12:33:11 +0000

(on pgjdbc/src/test/java/org/postgresql/util/PGbyteaTest.java)

Can the tests be parameterized?

---

From: "austb (@austb)" <[email-masked]>
Date: Wed, 13 Aug 2025 14:14:46 +0000

I don't think the whitespace handling is necessary, folks could always construct their strings to not have whitespace, but it is part of what postgresql allows in its queries, so if this wants to support any query it would need to.
```
select '\x AA BB CC'::bytea;
  bytea   
----------
 \xaabbcc
(1 row)
```

https://www.postgresql.org/docs/17/datatype-binary.html#DATATYPE-BINARY-BYTEA-HEX-FORMAT

> For input, the hexadecimal digits can be either upper or lower case, and whitespace is permitted between digit pairs (but not within a digit pair nor in the starting \x sequence).

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Wed, 13 Aug 2025 14:37:36 +0000

> I don't think the whitespace handling is necessary, folks could always construct their strings to not have whitespace

There might be an application (or library) that generates literals with whitespaces. As PostgreSQL accepts literals with whitespaces, we should be doing so.

---

From: "austb (@austb)" <[email-masked]>
Date: Sat, 20 Sep 2025 14:20:48 +0000

Just thought I'd check in and see if there's anything I can do to help move this PR along. I think it might have just fallen off the top of the pile, but let me know if I can do anything to help, thank you!

---

From: "corporate-gadfly (@corporate-gadfly)" <[email-masked]>
Date: Mon, 05 Jan 2026 22:00:04 +0000

Adding a link to the issue.

* Fixes #3757