pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: MrEasy (@MrEasy) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3365: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
Date: Mon, 26 Aug 2024 08:54:54 +0000
Message-ID: <[email protected]> (raw)
**Description**
After update from 42.7.3 to 42.7.4 we experienced a regression, which showed-up the error pasted below.
Looking into it, this seems to be a side-effect of fixing https://github.com/pgjdbc/pgjdbc/issues/3169
Scenario:
- Table with column of type ``bytea``.
- Creating a PreparedStamtent, e.g.
``PreparedStatement ps = connection.prepareStatement("INSERT INTO tTable VALUES (?,?)");``
- Invoking a ``ps.toString();`` on the PreparedStatement object without having set the bind variables then shows error below.
Seems the parameters are tried to get accessed despite not being set [(code location)](https://github.com/pgjdbc/pgjdbc/blame/master/pgjdbc/src/main/java/org/postgresql/core/v3/SimplePara...)
**Driver Version**
42.7.4
**Java Version**
21.0.4 (probably not related to the issue)
**PostgreSQL Version**
13.6 (probably not related to the issue)
**Logs**
```
org.postgresql.util.PSQLException: Unable to convert bytea parameter at position 0 to literal
at org.postgresql.core.v3.SimpleParameterList.toString(SimpleParameterList.java:262) ~[?:?]
at org.postgresql.core.NativeQuery.toString(NativeQuery.java:58) ~[?:?]
at org.postgresql.core.v3.SimpleQuery.toString(SimpleQuery.java:58) ~[?:?]
at org.postgresql.jdbc.PgPreparedStatement.toString(PgPreparedStatement.java:1081) ~[?:?]
at java.lang.String.valueOf(String.java:4465) ~[?:?]
at some.code.doing.PreparedStatementToString.toString(PreparedStatementToString.java:111) ~[?:?]
...
Caused by: java.io.EOFException: Premature end of input stream, expected 1,057 bytes, but only read 0.
at org.postgresql.util.PGbytea.toPGLiteral(PGbytea.java:199) ~[?:?]
at org.postgresql.core.v3.SimpleParameterList.toString(SimpleParameterList.java:253) ~[?:?]
... 102 more
```
view thread (34+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #3365: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox