Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvVqX-0000WQ-DB for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Apr 2017 21:18:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cvVqW-0002tR-Ty for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Apr 2017 21:18:36 +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 1cvVqW-0002tF-8z for pgsql-hackers@postgresql.org; Tue, 04 Apr 2017 21:18:36 +0000 Received: from mail-yw0-x231.google.com ([2607:f8b0:4002:c05::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cvVqO-0001dn-Ty for pgsql-hackers@postgresql.org; Tue, 04 Apr 2017 21:18:34 +0000 Received: by mail-yw0-x231.google.com with SMTP id p77so67752130ywg.1 for ; Tue, 04 Apr 2017 14:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=MVSdUVk2BNw2L32PF/S7s1P52lJFrGuWTTRy7OuWhBA=; b=n6oFQTt4kNyhWYxaHaZITJ2+hqtGQwutOc7lXfG9V7NAdy2Ie+3EYQpjZPqM2/JUv9 WxJC9mR1DShrUr++KuB092TbKZx1C/Kf7EowdkgNGGjOfzoCGDABxMmMFep/ztabCj4/ 4HbrJW069+HBURP+vIPxWH6jQgD19Gy3EDtSseAJiQFbynm2dDFiCZxLsfxbU1R+AOd9 DVSGUpSNzJ9cnp6mtM8R3twprwzOZgWzvBOlQ4S2eoYSkhaGioQmMRM7b/MNmT/YV4Do Z/0EoGI6EWmVGVaDIs08jdJV/8vw+yu7sEC67MYytE/ClMoeXHLG58movPF6/wxEwSyi PXpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=MVSdUVk2BNw2L32PF/S7s1P52lJFrGuWTTRy7OuWhBA=; b=f7us/DVXYszsoFL8v080isRmF9KpW1c/3H4MFWjospoliFcEOjaSl58gwMsXpl6Xmy 7mJS7vhROMMHw64+55eQqy25MktxW3UxiMc17kmruwa+YEdWQHsUc8Yw/YuRTeUuUcC+ XeuIoeP6THHGStjMEeV90R42xuMU8RsXv9HcT0bkpQWS39f2Zi0qHgvSAszTsxKwdt0k OFerQliK2XCEZnDoHy8AS1YB1+Ufg/HEkpzAObMs6BUtwVmFiOyJCw8gbigkIwWupK35 aeSwMC96iD+BsMvdK0H+aayvD179Io5W1bo9wdG1kdr/mFtbZqt0THgiUyDIm3j7Lah7 bVNw== X-Gm-Message-State: AFeK/H15NxoqUV0v1ihuuQ/75ztT6iRY5M3c+omY9+/IIX9RCfaMSvVx75oO7aLiJz2u3sTitEd0TndsAzYRM772mbo/9ga245TOa8O7myNAoFa52Uwg4LyYw8LJF9k1zME0kVNaXJV9JpAVM+VVGcbQCaNkEHZLSrO1nwVtArqNKiROFPJBnUr1VlcO65FddteuXZq0WC0RHgc= X-Received: by 10.129.116.214 with SMTP id p205mr18807997ywc.268.1491340708042; Tue, 04 Apr 2017 14:18:28 -0700 (PDT) Received: from [192.168.10.146] ([98.122.164.227]) by smtp.gmail.com with ESMTPSA id y132sm8574945ywy.0.2017.04.04.14.18.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 14:18:27 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: PATCH: recursive json_populate_record() To: Andres Freund 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> Cc: David Steele , Nikita Glukhov , Michael Paquier , Tom Lane , Aleksander Alekseev , PostgreSQL mailing lists Message-ID: <45c0aa55-1b62-c622-31fd-cb21e017d5cd@2ndQuadrant.com> Date: Tue, 4 Apr 2017 17:18:26 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <20170403211741.7ommm5dssfv3abo6@alap3.anarazel.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 04/03/2017 05:17 PM, Andres Freund wrote: > 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? > Hoping to, other demands have intervened a bit, but I might be able to. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers