Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4sY6-0006Z7-46 for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Oct 2017 17:54:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e4sY5-0008Ar-Am for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Oct 2017 17:54:33 +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 1e4sY4-0008AH-FZ for pgsql-bugs@postgresql.org; Wed, 18 Oct 2017 17:54:32 +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 1e4sY1-0007SU-5K for pgsql-bugs@postgresql.org; Wed, 18 Oct 2017 17:54:30 +0000 Received: by mail-yw0-x231.google.com with SMTP id a12so1276553ywm.4 for ; Wed, 18 Oct 2017 10:54: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:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=0re5PiPhwcK9CsO5oFWx6EFxZ72O591UPrHxNLuRciI=; b=bfmICTqk7Gz4tfy9Jh2LSy5FXnwENHNYZ+LXTKnVKMhjNFNADzfnkQEu4riX9S7ljf Huzf31gdaXqfV/ZA70GSAEAozubpfdYrGS6RO7a+wzhejkS3PT/GPrSCvHthrvcz5evp ZQdIVL/2E8UqoQuYZM0aqq6WV5zxTg7R3UrTxlxBcHB2IOlBwuIkSE5b0JmZZzD0IkKO b+epNUH/wHhtLYIfEfKKvMYrMZZYfTVCo6Qr+XAHD0ngYw7JWRI6MQun/qW1XkL6pew9 BWBWiO9o/y2kUt5RPYUqsF1s7JiXEtN1d3TFVHN/ZOqv++WMLFoLqMpVT1ZttmLdv0KX pZyA== 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:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=0re5PiPhwcK9CsO5oFWx6EFxZ72O591UPrHxNLuRciI=; b=ZR1NwKlwuHVv1avgmcOLsft4tcm/5HgbssH1iTReIabrL9bg02K7kk0LSngaA8u5uh TzIqVxp4wp6MxwPPGmrttN5deHsn1UHjkjfr3xZhYAndiwfDEIhloUY4tO5w+jcvnuXT PRomgS90jxf0KCGILEBrbPq9KEgNmurFJaCBb7lzAvevsFNRdvmAB8hUJmFUCviVQkoV R25DZYav98jr5FObSgGW9YVBNrH4NP10O2b+ECyvBunxmnzVyfMf13DpJZsNL/LnKO3d 0o9iJhl1oubypeafFfMrFwnpBMlf4WXk7U61rkmyBpXW4cW5wQOFrB8fdNo6eoHWwNoN 8bBA== X-Gm-Message-State: AMCzsaX5MbpLpb335ybnKSDa5amh7QvQWlfki+twPn8yI44SQzq0APr6 q2vnHE8+IlqYITpKrXV6QryENaGb8nm/Mca1KnuVpGSTF6yopOKPVLaERHjCuut4AP3OycpLg43 9uiAsu5nmo1aMkBy1M5zKToLOZe8+uyVAcEKcHAVeRL6TyxgF6V0XFlbSmGUFoZYybGmcjVym9Q g5e1RZCztx X-Google-Smtp-Source: ABhQp+RxWS6tUMGx3dR8wxYBW1V9WMaBPgBFzc+7UMLtcqKwWAA8qEa6yHOCSIvBAHUn0RpqfVxALw== X-Received: by 10.37.102.69 with SMTP id z5mr5008607ybm.5.1508349268044; Wed, 18 Oct 2017 10:54:28 -0700 (PDT) Received: from [192.168.10.146] ([98.122.175.38]) by smtp.gmail.com with ESMTPSA id m8sm6683197ywd.30.2017.10.18.10.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Oct 2017 10:54:27 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much To: Dmitry Dolgov <9erthalion6@gmail.com>, Michael Paquier Cc: Marko Tiikkaja , PostgreSQL mailing lists References: <20171011020058.27986.42308@wrigleys.postgresql.org> <76ff5ede-99a7-536b-4c26-0db0748ea6e1@2ndQuadrant.com> Message-ID: Date: Wed, 18 Oct 2017 13:54:26 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-MW 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 On 10/18/2017 11:47 AM, Dmitry Dolgov wrote: > > On 16 October 2017 at 02:08, Michael Paquier > > wrote: > > > >> Thanks for the patch. Everything looks fine, I just have one question - > >> maybe it makes sense to put this pattern `if (variadic) {/*...*/}` > into a > >> separate function? Because from what I see it's basically one part > of code > >> (I didn't spot any difference) repeated four times for every function. > > > > The json/jsonb calls have one difference though. For jsonb, arguments > > with unknown type are enforced to text, which is not the case of json, > > and we don't want to change that behavior. > > Oh, actually what I meant is to put into a separate function only the > first > branch of this condition, i.e. when `variadic` is true. But in general > I don't > really have strong opinion about that, so if you think that this > repetition is > not a problem, then fine. > > > There is a common place for JSON-common code in jsonapi.c, but > jsonapi.h is > > wanted as light-weight (see its set of headers), so moving things > there is > > incorrect as well IMO. > > Hm...did you mean `jsonfuncs.c` and `jsonapi.h`? It seems to me, that this > potential function (to handle `variadic` case) would not really > pollute it. If we really wanted to we could have it as a parameter to the function to do the special UNKONOWNOID handling or not. But I'm not sure it's worth it, especially on the back branches where we should try to do minimal code disturbance. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs