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

tree: fix decimal formatting for 0 with exponents <= -7 #102220

Closed

Conversation

otan
Copy link
Contributor

@otan otan commented Apr 25, 2023

We previously did not match PG in outputting 0 with exponents <= -7 over the wire. This is because we try to match the "GDA" spec, but PG doesn't follow that for 0 (it should display a solitary 0 if it did).

This 0E-7 formatting still shows up when using the Cockroach CLI tool. I verified it works correctly when connecting via the PG tool.

Release note (bug fix): Fixed a bug where 0s with exponents <= 7 in NUMERIC types would display in a different format compared with PostgreSQL (before: 0E-7 vs after/PG: 0.0000000) when sent over the wire.

Resolves #102217

We previously did not match PG in outputting 0 with exponents <= -7 over
the wire. This is because we try to match the "GDA" spec, but PG doesn't
follow that for 0 (it should display a solitary 0 if it did).

This 0E-7 formatting still shows up when using the Cockroach CLI tool. I
verified it works correctly when connecting via the PG tool.

Release note (bug fix): Fixed a bug where 0s with exponents <= 7 in
NUMERIC types would display in a different format compared with
PostgreSQL (before: 0E-7 vs after/PG: 0.0000000) when sent over the
wire.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@otan
Copy link
Contributor Author

otan commented Apr 25, 2023

this doesn't fix it, seems like some cache issue? the first invocation makes it "0E+16", but the second makes it "0.00000...".
We use decimal.String() all over the codebase which causes the issue.

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.

sql: 0 is formatted incorrectly for DECIMALs with scale >= 7
2 participants