Skip to content

pgadmin doesn't preserve trailing zeros in jsonb #9854

@CodesInChaos

Description

@CodesInChaos

Describe the bug

When storing numbers with trailing zeros in jsonb, postgres will preserve those those:

However, jsonb will preserve trailing fractional zeroes, as seen in this example, even though those are semantically insignificant for purposes such as equality checks.

However when I open such a jsonb document in pgadmin 4, the trailing zeros will not show in the edit window. This means that opening such a document, editing it and saving it via pgadmin will strip trailing zeros of numbers that weren't modified, which can break the appliation.

To Reproduce

SELECT (10.00).to_jsonb

In the row view it shows 10.00, but double clicking the field to open the pretty-printed json-editor view will replace it by 10.

Expected behavior

Preserve the trailing zeros, so that round-tripping a json document through the json editor doesn't modify data.

Screenshots

Screenshot, row view works Screenshot, editor view is broken

Desktop

  • OS: Freedesktop SDK 24.08 (Flatpak runtime), Linux-6.18.18-1-MANJARO-x86_64-with-glibc2.40
  • pgAdmin version: 9.14
  • Mode: Desktop
  • Browser: Chrome 146.0.7680.166
  • Package type: Flatpak

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions