Re: BUG #13533: jsonb_populate_record does not work when the value is a simple string

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paulo Vieira <paulovieira(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: BUG #13533: jsonb_populate_record does not work when the value is a simple string
Date: 2015-08-05 00:19:34
Message-ID: 20357.1438733974@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Paulo Vieira <paulovieira(at)gmail(dot)com> writes:
> On Mon, Aug 3, 2015 at 5:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> This does not seem like a bug, because the value of the data field is
>> just abc, and that isn't JSON. You'd need something more like
>>
>> input_data json := '{"id": 1, "data": "\"abc\""}';

> I'm confused. In my example the value is <double quotes>abc<double quotes>,
> which is a valid json value (and not simply abc).

No, the value of the field is just abc --- the quotes are JSON syntax
decoration, they are not part of the represented value. If we do it
as you seem to have in mind, it would be impossible to deal sanely
with data values that contain quotes or backslashes.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2015-08-05 00:40:02 Re: BUG #13533: jsonb_populate_record does not work when the value is a simple string
Previous Message Tom Lane 2015-08-04 22:22:17 Re: BUG #13530: sort receives "unexpected out-of-memory situation during sort"