Thread: Crash in json_to_record()

Crash in json_to_record()

From
Jeff Davis
Date:
The attached script crashes on master. It looks like it assumes
get_call_result_type() always returns a non-NULL tupdesc.

Regards,
    Jeff Davis


Attachment

Re: Crash in json_to_record()

From
Jeff Davis
Date:
On Fri, 2014-02-07 at 10:24 -0800, Jeff Davis wrote:
> The attached script crashes on master. It looks like it assumes
> get_call_result_type() always returns a non-NULL tupdesc.

Proposed patch attached; will commit soon unless someone objects.

Checking that get_call_result_type() returns TYPEFUNC_COMPOSITE seems to
be the convention for ensuring the tupdesc is set. I changed the 3 call
sites that do not currently follow that convention (all in jsonfuncs.c).

The other two call sites don't seem to be real problems, but following
the convention seems best.

For the one call site that actually is a problem, I added a HINT to
suggest calling the function from the FROM clause.

Regards,
    Jeff Davis


Attachment