Re: mogrify and indent features for jsonb - Mailing list pgsql-hackers

From Petr Jelinek
Subject Re: mogrify and indent features for jsonb
Date
Msg-id 553E67F6.8060602@2ndquadrant.com
Whole thread Raw
In response to Re: mogrify and indent features for jsonb  (Dmitry Dolgov <9erthalion6@gmail.com>)
Responses Re: mogrify and indent features for jsonb
Re: mogrify and indent features for jsonb
Re: mogrify and indent features for jsonb
List pgsql-hackers
On 18/04/15 20:35, Dmitry Dolgov wrote:
> Sorry for late reply. Here is a slightly improved version of the patch
> with the new `h_atoi` function, I hope this implementation will be more
> appropriate.
>

It's better, but a) I don't like the name of the function b) I don't see 
why we need the function at all given that it's called from only one 
place and is effectively couple lines of code.

In general I wonder if it wouldn't be better to split the replacePath 
into 3 functions, one replacePath, one replacePathObject, 
replacePathArray and call those Object/Array ones from the replacePath 
and inlining the h_atoi code into the Array one. If this was done then 
it would make also sense to change the main if/else in replacePath into 
a switch.

Another thing I noticed now when reading the code again - you should not 
be using braces when you only have one command in the code-block.

--  Petr Jelinek                  http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: Re: improving speed of make check-world
Next
From: Joel Jacobson
Date:
Subject: Re: PL/pgSQL, RAISE and error context