Re: inconsistent behaviour of json_to_record and friends with embedded json

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Robert Vollmert <rob(at)vllmrt(dot)net>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: inconsistent behaviour of json_to_record and friends with embedded json
Date: 2019-06-11 17:35:34
Message-ID: 17308.1560274534@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Dunstan 2019-06-11 18:53:58 Re: inconsistent behaviour of json_to_record and friends with embedded json
Previous Message Tobias Gierke 2019-06-11 14:35:43 (not a PG bug, please ignore) Re: PostgreSQL 11.3 hangs forever during DEALLOCATE statement