Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns
Date
Msg-id 17766.1403566448@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> On 06/23/2014 11:43 AM, Tom Lane wrote:
>> However, it seems to me that these functions (json[b]_to_record[set]) are
>> handling the nested-json-objects case in a fairly brain-dead fashion to
>> start with.  I would like to propose that we should think about getting
>> rid of the use_json_as_text flag arguments altogether.  What purpose do
>> they serve?  If we're going to the trouble of parsing the nested JSON
>> objects anyway, why don't we just reconstruct from that data?

> Looks like we have some problems in this whole area, not just the new 
> function, so we need to fix 9.3 also :-(

> IIRC, originally, the intention was to disallow nested json objects, but 
> the use_json_as_text was put in as a possibly less drastic possibility. 
> If we get rid of it our only recourse is to error out if we encounter 
> nested json. I was probably remiss in not considering the likelihood of 
> a json target field.

> I currently don't have lots of time to devote to this, sadly, but 
> Michael's patch looks like a good minimal fix.

I can spend some time on it over the next couple of days.  I take it you
don't have a problem with the concept of doing recursive processing,
as long as it doesn't add much complication?

I'm not following your comment about 9.3.  The json[b]_to_record[set]
functions are new in 9.4, which is what makes me feel it's not too
late to redefine their behavior.  But changing behavior of stuff that
was in 9.3 seems a lot more debatable.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: autovacuum scheduling starvation and frenzy
Next
From: Andrew Dunstan
Date:
Subject: Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns