Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zmlkg-0004dU-6T for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Oct 2015 16:51:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zmlkf-0005G1-G1 for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Oct 2015 16:51:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zmlk3-0004ZX-Ja for pgsql-bugs@postgresql.org; Thu, 15 Oct 2015 16:50:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zmlk1-0003gj-3f for pgsql-bugs@postgresql.org; Thu, 15 Oct 2015 16:50:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t9FGoqSI005490; Thu, 15 Oct 2015 12:50:52 -0400 From: Tom Lane To: Michael Paquier cc: b.yordanov2@gmail.com, PostgreSQL mailing lists Subject: Re: BUG #13680: PostgreSQL backend process crashes on jsonb_object_agg() in plpgsql recursive function In-reply-to: References: <20151014160818.3034.13514@wrigleys.postgresql.org> Comments: In-reply-to Michael Paquier message dated "Thu, 15 Oct 2015 14:41:57 +0900" Date: Thu, 15 Oct 2015 12:50:52 -0400 Message-ID: <5488.1444927852@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Michael Paquier 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. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs