Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cv9MC-0001TW-4t for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Apr 2017 21:17:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cv9MB-0003Oo-Ik for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Apr 2017 21:17:47 +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 1cv9MB-0003Of-6C for pgsql-hackers@postgresql.org; Mon, 03 Apr 2017 21:17:47 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cv9M8-00010j-5H for pgsql-hackers@postgresql.org; Mon, 03 Apr 2017 21:17:46 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id EC1232088A; Mon, 3 Apr 2017 17:17:42 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Mon, 03 Apr 2017 17:17:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=TvT+SKvwR70y0J50z4 pa9Sj4KhvFpeUk30gTfKBtVy4=; b=mQQdZHn3wM9KRebPQQp9kXL1wWKFGve//8 hy5l81LHbqqOF1D3b++p3BxLpnB5dLOesuSnrbwkUDGsMvMVM3HHBP1c8TjVVjD1 iMCyzJQ64klAAZ4Nt7U2gdnFpDwK3gAaN4k5WiSsyA5mCa8FywdMMZ2fRlI9BiKf df7ve3XG593AW6xgqlSFemWvaZjIvvPdKV7L09Af+D/KUTww916WhHOq6hFdGVRg gQDVkeF6xptPbFRJywMY5TfBX6XExAvZ8RnH7epkScIBtC4/Ufy05Lc2tvXmjdrB iVXvqNBEnhlnfz/eUVoEF8zWO7Olha7YKAUCMmeSGdHBi4FWcxfg== X-ME-Sender: X-Sasl-enc: CNNWj8q+6nhnftGt0LWNrAEFwLyrMvkMdPO0AuyIVcEi 1491254262 Received: from intern.anarazel.de (unknown [208.72.138.107]) by mail.messagingengine.com (Postfix) with ESMTPA id AF2EB7E21E; Mon, 3 Apr 2017 17:17:42 -0400 (EDT) Date: Mon, 3 Apr 2017 14:17:41 -0700 From: Andres Freund To: Andrew Dunstan Cc: David Steele , Nikita Glukhov , Michael Paquier , Tom Lane , Aleksander Alekseev , PostgreSQL mailing lists Subject: Re: PATCH: recursive json_populate_record() Message-ID: <20170403211741.7ommm5dssfv3abo6@alap3.anarazel.de> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <754780af-d905-9704-cf4d-b64e632b86a3@2ndQuadrant.com> X-Pg-Spam-Score: -2.6 (--) 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 On 2017-03-21 14:31:08 -0400, Andrew Dunstan wrote: > > > On 03/21/2017 01:37 PM, David Steele wrote: > > On 3/16/17 11:54 AM, David Steele wrote: > >> On 2/1/17 12:53 AM, Michael Paquier wrote: > >>> On Thu, Jan 26, 2017 at 6:49 AM, Tom Lane wrote: > >>>> Nikita Glukhov writes: > >>>>> On 25.01.2017 23:58, Tom Lane wrote: > >>>>>> I think you need to take a second look at the code you're producing > >>>>>> and realize that it's not so clean either. This extract from > >>>>>> populate_record_field, for example, is pretty horrid: > >>>> > >>>>> But what if we introduce some helper macros like this: > >>>> > >>>>> #define JsValueIsNull(jsv) \ > >>>>> ((jsv)->is_json ? !(jsv)->val.json.str \ > >>>>> : !(jsv)->val.jsonb || (jsv)->val.jsonb->type == jbvNull) > >>>> > >>>>> #define JsValueIsString(jsv) \ > >>>>> ((jsv)->is_json ? (jsv)->val.json.type == JSON_TOKEN_STRING \ > >>>>> : (jsv)->val.jsonb && (jsv)->val.jsonb->type == jbvString) > >>>> > >>>> Yeah, I was wondering about that too. I'm not sure that you can make > >>>> a reasonable set of helper macros that will fix this, but if you want > >>>> to try, go for it. > >>>> > >>>> BTW, just as a stylistic thing, I find "a?b:c||d" unreadable: I have > >>>> to go back to the manual every darn time to convince myself whether > >>>> that means (a?b:c)||d or a?b:(c||d). It's better not to rely on > >>>> the reader (... or the author) having memorized C's precedence rules > >>>> in quite that much detail. Extra parens help. > >>> > >>> Moved to CF 2017-03 as discussion is going on and more review is > >>> needed on the last set of patches. > >>> > >> > >> The current patches do not apply cleanly at cccbdde: > >> > >> $ git apply ../other/0001-introduce-JsonContainerXxx-macros-v04.patch > >> error: patch failed: src/backend/utils/adt/jsonb_util.c:328 > >> error: src/backend/utils/adt/jsonb_util.c: patch does not apply > >> error: patch failed: src/backend/utils/adt/jsonfuncs.c:1266 > >> error: src/backend/utils/adt/jsonfuncs.c: patch does not apply > >> error: patch failed: src/include/utils/jsonb.h:218 > >> error: src/include/utils/jsonb.h: patch does not apply > >> > >> In addition, it appears a number of suggestions have been made by Tom > >> that warrant new patches. Marked "Waiting on Author". > > > > This thread has been idle for months since Tom's review. > > > > The submission has been marked "Returned with Feedback". Please feel > > free to resubmit to a future commitfest. > > > > > > Please revive. I am planning to look at this later this week. Since that was 10 days ago - you're still planning to get this in before the freeze? - Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers