pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
17+ messages / 4 participants
[nested] [flat]

* [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2024-08-29 13:46  "MrEasy (@MrEasy)" <[email protected]>
  0 siblings, 0 replies; 17+ messages in thread

From: MrEasy (@MrEasy) @ 2024-08-29 13:46 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Test case reproducing issue of #3365.
Fix by @kimjand  

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2024-12-09 08:08  "MrEasy (@MrEasy)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: MrEasy (@MrEasy) @ 2024-12-09 08:08 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

> Could you keep the old method names and signatures?

@kimjand added a method, that differs from existing one (see javadoc), not sure what you @vlsi mean with keeping the old names?

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-03-20 10:47  "davecramer (@davecramer)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: davecramer (@davecramer) @ 2025-03-20 10:47 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

> > Could you keep the old method names and signatures?
> 
> @kimjand added a method, that differs from existing one (see javadoc), not sure what you @vlsi mean with keeping the old names?

Instead of using toStringLiteral() use toString()

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-03-20 13:32  "MrEasy (@MrEasy)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: MrEasy (@MrEasy) @ 2025-03-20 13:32 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

> > > Could you keep the old method names and signatures?
> > 
> > 
> > @kimjand added a method, that differs from existing one (see javadoc), not sure what you @vlsi mean with keeping the old names?
> 
> Instead of using toStringLiteral() use toString()

From javadoc, I'd assume this was on purpose. @kimjand could you comment on this?

Would be great if we can get the fix into next release, as this blocks our update to recent versions. 

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-03-20 15:45  "kimjand (@kimjand)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: kimjand (@kimjand) @ 2025-03-20 15:45 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

On 20-03-2025 14:32, Rico Neubauer wrote:
>             Could you keep the old method names and signatures?
> 
>         @kimjand <https://github.com/kimjand; added a method, that
>         differs from existing one (see javadoc), not sure what you @vlsi
>         <https://github.com/vlsi; mean with keeping the old names?
> 
>     Instead of using toStringLiteral() use toString()
> 
>  From javadoc, I'd assume this was on purpose. @kimjand <https:// 
> github.com/kimjand> could you comment on this?
> 

Yes, this was completely intentional. The core of this bug is that the 
driver can't decide on what the methods are supposed to do. ToString 
claims it provides human readable output, but the driver expects it to 
contain literals for the parameter values.
Now there is a clear distinction between the two cases.


^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-04-24 20:29  "vlsi (@vlsi)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: vlsi (@vlsi) @ 2025-04-24 20:29 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

I'm working on this. Please let me have a couple of days more

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-15 07:57  "vlsi (@vlsi)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: vlsi (@vlsi) @ 2025-05-15 07:57 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(on pgjdbc/src/main/java/org/postgresql/core/v3/CompositeQuery.java)

This still looks like a bug. The input `parameters` are not used at all. So `toString()` would be the same as `toExecutableSql()`, so there's no point in having `if` here.


^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-15 14:32  "vlsi (@vlsi)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: vlsi (@vlsi) @ 2025-05-15 14:32 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Looks like for `toString` we need the following:

```java
@Nullable ParameterList params; // optional
boolean standardConformingStrings;
boolean idempotent; // == skipInputStreams
```

I wonder if we use an interface for it instead of (boolean, boolean) parameters?

Currently we have

```java
String toString(@Nullable ParameterList params, boolean standardConformingStrings);
String toExecutable(@Nullable ParameterList params, boolean standardConformingStrings);
```

What if we go for the following?

```java
interface SqlContext {
  boolean getStandardConformingStrings();
  boolean getIdempotent();
}

@Deprecated
String toString(@Nullable ParameterList params, boolean standardConformingStrings);

String toString(@Nullable ParameterList params, SqlContext context);
```


^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-15 16:59  "vlsi (@vlsi)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: vlsi (@vlsi) @ 2025-05-15 16:59 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(on pgjdbc/src/main/java/org/postgresql/core/v3/SqlSerializationContext.java:11)

@bokken , @sehrope , WDYT of this?
I'm not sure regarding the name, however, I like the interface approach better than two methods `toString` and `toExecutableSql`.

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-16 12:03  "vlsi (@vlsi)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: vlsi (@vlsi) @ 2025-05-16 12:03 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

I'm happy with the current state of the PR.
Reviews are welcome.
Will merge the PR in a couple of days.

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-20 14:09  "davecramer (@davecramer)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: davecramer (@davecramer) @ 2025-05-20 14:09 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(on pgjdbc/src/main/java/org/postgresql/core/v3/SqlSerializationContext.java:11)

I like this idea

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-20 14:11  "davecramer (@davecramer)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: davecramer (@davecramer) @ 2025-05-20 14:11 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(on pgjdbc/src/main/java/org/postgresql/core/Query.java)

`so it should not be used only once` seems wrong ... did you mean `so it should only be used once` ...

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-20 14:11  "davecramer (@davecramer)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: davecramer (@davecramer) @ 2025-05-20 14:11 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(on pgjdbc/src/main/java/org/postgresql/core/Query.java)

`so it should not be used only once` seems wrong ... did you mean `so it should only be used once` ...

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-20 14:20  "davecramer (@davecramer)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: davecramer (@davecramer) @ 2025-05-20 14:20 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(on pgjdbc/src/main/java/org/postgresql/core/v3/DefaultSqlSerializationContext.java:17)

I think it would be useful to document why and where each of these are used.
For instance we use IDEMPOTENT to send the query to the backend
STD is standard conforming strings which is a setting in the backend.

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-21 12:33  "vlsi (@vlsi)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: vlsi (@vlsi) @ 2025-05-21 12:33 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(on pgjdbc/src/main/java/org/postgresql/core/Query.java)

Good catch. The doc was outdated as the behaviour is configurable via `SqlSerializationContext` parameter. I will drop the note and add `@param context specifies configuration for converting the parameters to string`

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-21 12:47  "vlsi (@vlsi)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: vlsi (@vlsi) @ 2025-05-21 12:47 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

(on pgjdbc/src/main/java/org/postgresql/core/v3/DefaultSqlSerializationContext.java:17)

I've added the doc to the enum entries

^ permalink  raw  reply  [nested|flat] 17+ messages in thread

* Re: [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4
@ 2025-05-21 15:02  "davecramer (@davecramer)" <[email protected]>
  15 siblings, 0 replies; 17+ messages in thread

From: davecramer (@davecramer) @ 2025-05-21 15:02 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

LGTM

^ permalink  raw  reply  [nested|flat] 17+ messages in thread


end of thread, other threads:[~2025-05-21 15:02 UTC | newest]

Thread overview: 17+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-08-29 13:46 [pgjdbc/pgjdbc] PR #3369: fix: EOFException on PreparedStatement#toString with unset bytea parameter since 42.7.4 "MrEasy (@MrEasy)" <[email protected]>
2024-12-09 08:08 ` "MrEasy (@MrEasy)" <[email protected]>
2025-03-20 10:47 ` "davecramer (@davecramer)" <[email protected]>
2025-03-20 13:32 ` "MrEasy (@MrEasy)" <[email protected]>
2025-03-20 15:45 ` "kimjand (@kimjand)" <[email protected]>
2025-04-24 20:29 ` "vlsi (@vlsi)" <[email protected]>
2025-05-15 07:57 ` "vlsi (@vlsi)" <[email protected]>
2025-05-15 14:32 ` "vlsi (@vlsi)" <[email protected]>
2025-05-15 16:59 ` "vlsi (@vlsi)" <[email protected]>
2025-05-16 12:03 ` "vlsi (@vlsi)" <[email protected]>
2025-05-20 14:09 ` "davecramer (@davecramer)" <[email protected]>
2025-05-20 14:11 ` "davecramer (@davecramer)" <[email protected]>
2025-05-20 14:11 ` "davecramer (@davecramer)" <[email protected]>
2025-05-20 14:20 ` "davecramer (@davecramer)" <[email protected]>
2025-05-21 12:33 ` "vlsi (@vlsi)" <[email protected]>
2025-05-21 12:47 ` "vlsi (@vlsi)" <[email protected]>
2025-05-21 15:02 ` "davecramer (@davecramer)" <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox