From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Robert Vollmert <rob@vllmrt.net>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: inconsistent behaviour of json_to_record and friends with embedded json
Date: Tue, 11 Jun 2019 13:35:34 -0400
Message-ID: <17308.1560274534@sss.pgh.pa.us> (raw)
In-Reply-To: <19461.1559506457@sss.pgh.pa.us>
References: <D6921B37-BD8E-4664-8D5F-DB3525765DCD@vllmrt.net>
<CAMkU=1yjwaXTEDG3b-LC54s4y6BpmUsS8z-WvP8oA_ryukk8+w@mail.gmail.com>
<19461.1559506457@sss.pgh.pa.us>
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.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, andrew@dunslane.net, jeff.janes@gmail.com, rob@vllmrt.net
Subject: Re: inconsistent behaviour of json_to_record and friends with embedded json
In-Reply-To: <17308.1560274534@sss.pgh.pa.us>
References: <D6921B37-BD8E-4664-8D5F-DB3525765DCD@vllmrt.net> <CAMkU=1yjwaXTEDG3b-LC54s4y6BpmUsS8z-WvP8oA_ryukk8+w@mail.gmail.com> <19461.1559506457@sss.pgh.pa.us> <17308.1560274534@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox