Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: b(dot)yordanov2(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function
Date: 2015-10-15 23:49:22
Message-ID: CAB7nPqS-KShG7PVQf2LFUkxcGsL9geSt_fbaTMBawSCq0j4NmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Oct 16, 2015 at 1:50 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
>> It happens that jsonb_object_agg_transfn is not able to manage
>> correctly NULL values in the context of a JSONB value, and it seems to
>> me that this is caused by an oversight in datum_to_jsonb regarding the
>> handling of NULL values.
>
>> Attached is a patch with some regression tests for master and
>> REL9_5_STABLE where the bug has been introduced.
>
> This looks sane to me, although since the function's header comment
> specifies that tcategory is not to be relied on when is_null is true,
> I think it would be cleaner to test is_null before looking at tcategory.
> Will adjust and push.

Thanks!
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2015-10-16 02:00:51 Re: PQexec() hangs on OOM
Previous Message Tom Lane 2015-10-15 16:50:52 Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function