Re: inconsistent behaviour of json_to_record and friends with embedded json
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jeff Janes <jeff.janes@gmail.com>, Robert Vollmert <rob@vllmrt.net>,
pgsql-bugs@lists.postgresql.org
Date: 2019-06-11T18:53:58Z
Lists: pgsql-bugs
On 6/11/19 1:35 PM, Tom Lane wrote: > I wrote: >> I agree. It looks to me like the problem is this over-optimistic >> assumption: >> /* >> * Add quotes around string value (should be already escaped) if >> * converting to json/jsonb. >> */ >> No, it's *not* already escaped. Fixing the code to use escape_json() >> is a bit tedious, because for some reason that function wasn't designed >> to support non-null-terminated input, but with the attached patch we get >> what seems to me like sane behavior: > Hearing no comments, I've pushed this patch. I also rewrote the > documentation to provide something approaching a specification for > what json_to_record() and friends do. Sorry, I meant to tell you your fix looked good to me, it slipped through the net. Thanks for fixing this. cheers andrew
Commits
-
Fix conversion of JSON strings to JSON output columns in json_to_record().
- 6f34fcbbd5ad 12.0 landed
- b6f5689aadf4 10.9 landed
- 1c9034579c02 11.4 landed
-
Make json_populate_record and friends operate recursively
- cf35346e813e 10.0 cited