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

Fix NumericDecodeUtils.decodeBinary(byteBuf) decoding #558

Closed

Conversation

alphaville76
Copy link

…result for BigDecimal between 1 and -1

Make sure that:

  • You have read the contribution guidelines.
  • You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
  • You use the code formatters provided here and have them applied to your changes. Don't submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

Issue description

I use the some test data as in https://github.com/pgjdbc/pgjdbc/blob/a29767eaa27b97a68c21dee04e8483872783f2e2/pgjdbc/src/test/java/org/postgresql/util/BigDecimalByteConverterTest.java plus some more data.

To create the BigDecimal in binary format, I use the util method ByteConverter.numeric provided by the jdbc postgres drivers.

…wrong result for BigDecimal between 1 and -1
@mp911de mp911de changed the title Fix bug #556: NumericDecodeUtils.decodeBinary(byteBuf) returns wrong … Fix NumericDecodeUtils.decodeBinary(byteBuf) decoding Nov 9, 2022
@mp911de mp911de added the type: bug A general bug label Nov 9, 2022
@mp911de mp911de added this to the 0.9.3.RELEASE milestone Nov 9, 2022
mp911de pushed a commit that referenced this pull request Nov 9, 2022
Previously, decodeBinary returned a wrong result for BigDecimal between 1 and -1. Now the decoding is implemented as per the Postgres spec.

[#558][resolves #556]
mp911de added a commit that referenced this pull request Nov 9, 2022
Replace String.format(…) with our own digit rendering and padding to reduce computation on hot code paths.

[resolves #558][#556]

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
mp911de pushed a commit that referenced this pull request Nov 9, 2022
Previously, decodeBinary returned a wrong result for BigDecimal between 1 and -1. Now the decoding is implemented as per the Postgres spec.

[#558][resolves #556]
@mp911de mp911de closed this in ac64d9a Nov 9, 2022
@mp911de
Copy link
Collaborator

mp911de commented Nov 9, 2022

Thank you for your contribution. That's merged, polished, and backported now.

@mp911de mp911de self-assigned this Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NumericDecodeUtils.decodeBinary(byteBuf) returns wrong result for BigDecimal between 1 and -1
3 participants