vertx-sql-client icon indicating copy to clipboard operation
vertx-sql-client copied to clipboard

PgClient Timestamps are encoded with microsecond resolution by truncation instead of by rounding

Open donders opened this issue 3 years ago • 0 comments

I suspect this method handles all encoding for postgres timestamps for the vertx pg client: https://github.com/eclipse-vertx/vertx-sql-client/blob/98c50d8cb463e352931688ff35948435c3abefef/vertx-pg-client/src/main/java/io/vertx/pgclient/impl/codec/DataTypeCodec.java#L1078-L1085

It uses LocalDateTime.until() to truncate down to whole microseconds.

The JDBC driver for PGDB uses rounding for timestamps, which exposed test assertion discrepancies in my project between database interactions that use the JDBC driver and ones that use the vertx pg client. The JDBC Driver maintainer's response is that psql supposedly also does rounding to the nearest microsecond.

Java doesn't seem to have a way to centrally change time resolution, so I consider truncation vs rounding to be a side effect of the database driver/client.

Does Vertx agree with this?

donders avatar Mar 18 '22 12:03 donders