Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFU8j-00048i-Ps for pgsql-hackers@arkaria.postgresql.org; Mon, 29 May 2017 23:31:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dFU8j-0000Ed-Cc for pgsql-hackers@arkaria.postgresql.org; Mon, 29 May 2017 23:31:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dFU8h-0000C8-SJ for pgsql-hackers@postgresql.org; Mon, 29 May 2017 23:31:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dFU8f-0002XB-4T for pgsql-hackers@postgresql.org; Mon, 29 May 2017 23:31:54 +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 v4TNVju3010872; Mon, 29 May 2017 19:31:45 -0400 From: Tom Lane To: Nikita Glukhov cc: Andrew Dunstan , Andres Freund , David Steele , Michael Paquier , Aleksander Alekseev , PostgreSQL mailing lists Subject: Re: PATCH: recursive json_populate_record() In-reply-to: References: <687e19a7-14e2-d0f5-2bff-35d62bc5c05a@postgrespro.ru> <934.1485111512@sss.pgh.pa.us> <9e21a39c-c1d7-b9b5-44a0-c5345a5029f6@postgrespro.ru> <13020.1485377905@sss.pgh.pa.us> <295ad4a5-2923-1834-5140-35d0b9a5818c@postgrespro.ru> <16179.1485380983@sss.pgh.pa.us> <9bf14a7c-0794-f90c-c012-8dd0335ab364@pgmasters.net> <754780af-d905-9704-cf4d-b64e632b86a3@2ndQuadrant.com> <20170403211741.7ommm5dssfv3abo6@alap3.anarazel.de> <45c0aa55-1b62-c622-31fd-cb21e017d5cd@2ndQuadrant.com> <8fcd9e65-acb0-8221-ef23-01e5c2fe90e4@2ndQuadrant.com> Comments: In-reply-to Nikita Glukhov message dated "Mon, 22 May 2017 22:19:37 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10870.1496100705.1@sss.pgh.pa.us> Date: Mon, 29 May 2017 19:31:45 -0400 Message-ID: <10871.1496100705@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-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Nikita Glukhov writes: > Attached two small fixes for the previous committed patch: > 1. I've noticed a difference in behavior between json_populate_record() > and jsonb_populate_record() if we are trying to populate record from a > non-JSON-object: json function throws an error but jsonb function returns > a record with NULL fields. So I think it would be better to throw an error > in jsonb case too, but I'm not sure. Agreed on the error. I reformatted the code a bit. > 2. Also I've found a some kind of thinko in JsGetObjectSize() macro, but it > seems that this obvious mistake can not lead to incorrect behavior. Hm, I think it actually was wrong for the case of jsonb_cont == NULL, wasn't it? But maybe that case didn't arise for the sole call site. Anyway, agreed. Pushed both patches. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers