Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWSO6-0003nK-BT for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jan 2017 18:33:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cWSO5-0004Gk-OR for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jan 2017 18:33:41 +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_2) (envelope-from ) id 1cWSO4-0004Fx-Cr for pgsql-hackers@postgresql.org; Wed, 25 Jan 2017 18:33:40 +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_2) (envelope-from ) id 1cWSNv-0007zs-AQ for pgsql-hackers@postgresql.org; Wed, 25 Jan 2017 18:33:38 +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 v0PIXOgb005731; Wed, 25 Jan 2017 13:33:24 -0500 From: Tom Lane To: Nikita Glukhov cc: Aleksander Alekseev , Michael Paquier , PostgreSQL mailing lists Subject: Re: PATCH: recursive json_populate_record() In-reply-to: <9e21a39c-c1d7-b9b5-44a0-c5345a5029f6@postgrespro.ru> References: <222c7cfb-73c8-a56e-7844-3dc51682760d@postgrespro.ru> <20161227131541.GA6976@e733.localdomain> <1b72a62e-fd94-fd6d-c573-870af0c8600d@postgrespro.ru> <11489.1483901523@sss.pgh.pa.us> <687e19a7-14e2-d0f5-2bff-35d62bc5c05a@postgrespro.ru> <934.1485111512@sss.pgh.pa.us> <9e21a39c-c1d7-b9b5-44a0-c5345a5029f6@postgrespro.ru> Comments: In-reply-to Nikita Glukhov message dated "Wed, 25 Jan 2017 01:25:01 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5729.1485369204.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 25 Jan 2017 13:33:24 -0500 Message-ID: <5730.1485369204@sss.pgh.pa.us> X-Pg-Spam-Score: -5.1 (-----) 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: > On 22.01.2017 21:58, Tom Lane wrote: >> If you want such macros I think it would be better to submit a separate >> cosmetic patch that tries to hide such bit-tests behind macros throughout >> the jsonb code. > I've attached that patch, but not all the bit-tests were hidden: some of = them > in jsonb_util.c still remain valid after upcoming refactoring because they > don't belong to generic code (there might be better to use JBC_XXX() macr= os). Pushed this; grepping found a couple other places that could be replaced by the macros, so I did. I didn't include the JsonContainerIsEmpty macro, though. It wasn't used anywhere, and I'm not exactly convinced that "IsEmpty" is more readable than "Size =3D=3D 0", anyhow. We can add it later if the use-case gets stronger. > Sorry for this obvious mistake. But macros JB_ROOT_IS_XXX() also contain= the > same hazard. Good point, fixed. I'll look at the rest of this in a bit. regards, tom lane --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers