Re: PATCH: recursive json_populate_record()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
Cc: Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: recursive json_populate_record()
Date: 2017-01-25 18:33:24
Message-ID: 5730.1485369204@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> writes:
> On 22.01.2017 21:58, Tom Lane wrote:
>> If you want such macros I think it would be better to submit a separate
>> cosmetic patch that tries to hide such bit-tests behind macros throughout
>> the jsonb code.

> I've attached that patch, but not all the bit-tests were hidden: some of them
> in jsonb_util.c still remain valid after upcoming refactoring because they
> don't belong to generic code (there might be better to use JBC_XXX() macros).

Pushed this; grepping found a couple other places that could be replaced
by the macros, so I did.

I didn't include the JsonContainerIsEmpty macro, though. It wasn't used
anywhere, and I'm not exactly convinced that "IsEmpty" is more readable
than "Size == 0", anyhow. We can add it later if the use-case gets
stronger.

> Sorry for this obvious mistake. But macros JB_ROOT_IS_XXX() also contain the
> same hazard.

Good point, fixed.

I'll look at the rest of this in a bit.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2017-01-25 18:37:22 Re: Checksums by default?
Previous Message Corey Huinker 2017-01-25 18:23:53 Re: COPY as a set returning function