Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUMERIC/DECIMAL without precision are truncated on fetch with latest postgres jdbc driver #12565

Closed
pyranja opened this issue Oct 28, 2021 · 4 comments

Comments

@pyranja
Copy link

pyranja commented Oct 28, 2021

Expected behavior

We use tables with NUMERIC/DECIMAL values without precision. These are mapped to BigDecimal values.

Actual behavior

With the latest postgres jdbc driver 42.3.0, larger fetched values are being truncated:

  • example: column value 20000.0 , fetched value in jooq result: 2.0
  • this is not happening consistently, it seems that a few initial fetches work
  • we were able to reproduce in a test with a local database:
    • running a query once shows no problem, conversion is correct
    • after ~5-10 query executions, values are truncated

Steps to reproduce the problem

  • A complete set of DDL statements can help re-create the setup you're having
  • An MCVE can be helpful to provide a complete reproduction case: https://github.com/jOOQ/jOOQ-mcve

I'm working on mitigating the fallout in our live system, not sure when/if I can share a reproducer.

Versions

  • jOOQ: 3.15.3
  • Java: amazoncorretto 11
  • Database (include vendor): AWS Aurora PG 12 / local postgres v 12
  • OS: AWS ECS Fargate / local Ubuntu
  • JDBC Driver (include name if inofficial driver): postgres v42.3.0
@pyranja
Copy link
Author

pyranja commented Oct 28, 2021

I'd have to extract a minimal example when I find time. But maybe this info already helps.
To give you an idea:

Looped query in the reproducer:
image

Output of the reproducer test:
After a few iterations the result from jooq shows a different value than the result set via plain jdbc.

image

@pyranja
Copy link
Author

pyranja commented Oct 28, 2021

Perhaps related to pgjdbc/pgjdbc#1716

This addresses #1712. It is a breaking change, but if the correct getter
(getInt) is used for the column, there is no difference. Other getters may behave
differently.

🤔

@pyranja
Copy link
Author

pyranja commented Oct 28, 2021

This has been reported as bug in the driver itself in pgjdbc/pgjdbc#2326
And it seems to be confirmed by the maintainers.

I'm closing this, as jooq seems to be the victim here :/ Apologies @lukaseder

@lukaseder
Copy link
Member

Thanks a lot for your analysis and for documenting this here as well.

@lukaseder lukaseder moved this from To do to Done in 3.16 Other improvements Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

2 participants