Skip to content

spring-data-jdbc and postgres: Trailing junk on timestamp #935

Closed
@ghost

Description

Original question here: https://stackoverflow.com/q/66484578

Small gradle project with a junit test to reproduce the error: https://github.com/schachtelhalm/minimal-demo

With spring boot 2.3.8 this junit test doesn't fail, with 2.3.9 it fails with
java.lang.NumberFormatException: Trailing junk on timestamp: 'T21:26:13.318881+01:00'
Tested with openjdk 11.0.10.
Complete stacktrace on minimal-demo page.

The query method is in a Repository that extends CrudRepository:

    @Query("SELECT` * FROM animal WHERE updated_at > :lastUpdate")
    List<Animal> findByUpdatedAtGreaterThan(@Param("lastUpdate") OffsetDateTime lastUpdate);

The entity has a field private Timestamp updatedAt;

When I tried to debug the original application I set a breakpoint in org.postgresql.jdbc.TimestampUtils.parseBackendTimestamp(). With spring boot 2.3.8 I think I only hit the method for timestamps from the database rows, but not for the parameter of the query. With 2.3.9 the method parseBackendTimestamp() was also called for the parameter I'd used with curl requests for the RestController.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions