Message-ID: From: "rbrw (@rbrw)" To: "pgjdbc/pgjdbc" Date: Tue, 01 Apr 2025 17:51:51 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3365: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4 In-Reply-To: References: List-Id: X-GitHub-Author-Login: rbrw X-GitHub-Comment-Id: 2770250707 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2025-04-01T18:11:17Z X-GitHub-Issue: 3365 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3365#issuecomment-2770250707 Content-Type: text/plain; charset=utf-8 While I definitely don't know pgjdbc well enough to have a good sense whether this is a reasonable fix for now, and even if it were, I'd guess it's too naive, this patch (given @davecramer's question) does appear to fix at least the [PuppetDB issue](https://github.com/pgjdbc/pgjdbc/issues/3365#issuecomment-2685237545): ```diff diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java b/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java index 30528ee7..b318c665 100644 --- a/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java +++ b/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java @@ -250,21 +250,7 @@ class SimpleParameterList implements V3ParameterList { String textValue; String type; if (paramTypes[index] == Oid.BYTEA) { - try { - return PGbytea.toPGLiteral(paramValue); - } catch (Throwable e) { - Throwable cause = e; - if (!(cause instanceof IOException)) { - // This is for compatibilty with the similar handling in QueryExecutorImpl - cause = new IOException("Error writing bytes to stream", e); - } - throw sneakyThrow( - new PSQLException( - GT.tr("Unable to convert bytea parameter at position {0} to literal", - index), - PSQLState.INVALID_PARAMETER_VALUE, - cause)); - } + return "?"; } if ((flags[index] & BINARY) == BINARY) { // handle some of the numeric types ``` Even if the change is inadequate upstream, it'd be useful to know if it might be acceptable for say Debian in the shorter term because the regression has complicated getting the newer PuppetDB into the next Debian stable release before the freeze (happening now). Thanks for any help