Re: PATCH: recursive json_populate_record()

Nikita Glukhov <n.gluhov@postgrespro.ru>

From: Nikita Glukhov <n.gluhov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>, Andres Freund <andres@anarazel.de>, David Steele <david@pgmasters.net>, Michael Paquier <michael.paquier@gmail.com>, Aleksander Alekseev <a.alekseev@postgrespro.ru>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-05-30T23:10:34Z
Lists: pgsql-hackers
On 30.05.2017 02:31, Tom Lane wrote:

> Nikita Glukhov <n.gluhov@postgrespro.ru> writes:
>> 2. Also I've found a some kind of thinko in JsGetObjectSize() macro, but it
>> seems that this obvious mistake can not lead to incorrect behavior.
> Hm, I think it actually was wrong for the case of jsonb_cont == NULL,
> wasn't it?

Yes, JsObjectIsEmpty() returned false negative answer for jsonb_cont == NULL,
but this could only lead to suboptimal behavior of populate_record() when the
default record value was given.

> But maybe that case didn't arise for the sole call site.
It also seems to me that populate_record() can't be called now with
jsonb_cont == NULL from the existing call sites.

-- 
Nikita Glukhov
Postgres Professional:http://www.postgrespro.com
The Russian Postgres Company



Commits

  1. Make edge-case behavior of jsonb_populate_record match json_populate_record

  2. Fix thinko in JsObjectSize() macro.

  3. Introduce convenience macros to hide JsonbContainer header accesses better.