Skip to content

Conversation

xfischer
Copy link
Contributor

@xfischer xfischer commented Jan 24, 2024

Hi ! I had an issue when dealing with decimal zero with scale defined (ie 0.00M).
Those fields were converted to plain 0M, loosing the scale.

I've added a "naive" fix to address this issue and a test showcasing the issue. I'm sorry to provide comparison with string representation, but I couldn't find a proper way to check if 0.00M is a zero with 2 decimal places also 0.

BTW I want to thank you for the great work here !

@xfischer xfischer changed the title scale was lost when dealing with decimal zero Decimal scale was lost when dealing with decimal zero Jan 24, 2024
@NinoFloris
Copy link
Member

@xfischer Thanks for finding this edge case!

I've pushed a small change to your branch, but overall LGTM.

@xfischer
Copy link
Contributor Author

Thanks ! Works for me. Should I start the PR again ?

@NinoFloris
Copy link
Member

@xfischer no need! It was late and CI was slow.

It all looks good so I'll merge this in now.
Thanks again.

@NinoFloris NinoFloris merged commit c51e6d0 into npgsql:main Jan 31, 2024
NinoFloris pushed a commit that referenced this pull request Jan 31, 2024
@NinoFloris
Copy link
Member

Backported to 8.0.2 via 2d85369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants