Re: Crash in json_to_record() - Mailing list pgsql-bugs

From Jeff Davis
Subject Re: Crash in json_to_record()
Date
Msg-id 1393213204.17606.6.camel@jdavis
Whole thread Raw
In response to Crash in json_to_record()  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: [HACKERS] Re: BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding
Next
From: Sandeep Thakkar
Date:
Subject: Re: BUG #9307: I can not install the binary version 9.3.3 under Windows 7 Ultimate