pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.56k stars 659 forks source link

Ctrl-C on JSONB string creates badly quoted contents #8157

Open riuttner opened 1 week ago

riuttner commented 1 week ago

Trying to copy any JSONB contents from Data Output window by keystroke Ctrl-C ends up with a copy buffer containing a double-quoted string, having all double quotes inside doubled.

Execute: select '{"a":"bbb", "c":"ddd"}'::jsonb

Double click single result opens a view showing:

{
   "a": "bbb",
   "c": "ddd"
}

Select all lines, press Ctrl-C, paste contents anywhere in pgadmin or in any text editor. This will yield the wrong result: "{""a"": ""bbb"", ""c"": ""ddd""}"

Expected result is: {"a":"bbb", "c":"ddd"}

This bug also appears for contents of type JSON, not only for JSONB. I could observe it all the time after upgrading from 8.12 to 8.13. Apparently the latest release just accidentally uses the wrong quotes for copied JSON strings, which internally also leads to doubled double quotes.

Tested in environment: Version 8.13 Application Mode Desktop Commit: b2782650055dd41c060cd016f29ecd5575cd1828 2024-11-11 Current User pgadmin4@pgadmin.org Electron Version 33.2.0 Browser Chrome 130.0.6723.118 Operating System Windows-10-10.0.19045-SP0