From: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
---|---|
To: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | Marko Tiikkaja <marko(at)joh(dot)to>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much |
Date: | 2017-10-18 17:54:26 |
Message-ID: | dbde1be7-d9d7-0951-f976-b8118da66199@2ndQuadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
On 10/18/2017 11:47 AM, Dmitry Dolgov wrote:
> > On 16 October 2017 at 02:08, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com <mailto:michael(dot)paquier(at)gmail(dot)com>> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Ian R. Campbell | 2017-10-18 20:12:56 | ON COMMIT DROP unstable behaviour |
Previous Message | Dmitry Dolgov | 2017-10-18 15:47:11 | Re: BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-10-18 18:50:53 | Re: Supporting Windows SChannel as OpenSSL replacement |
Previous Message | Justin Pryzby | 2017-10-18 17:40:09 | Re: SIGSEGV in BRIN autosummarize |