Re: PATCH: recursive json_populate_record()
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>,
Michael Paquier <michael.paquier@gmail.com>,
PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-01-25T18:33:24Z
Lists: pgsql-hackers
Nikita Glukhov <n.gluhov@postgrespro.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
Commits
-
Make edge-case behavior of jsonb_populate_record match json_populate_record
- 68cff231e3a3 10.0 landed
-
Fix thinko in JsObjectSize() macro.
- e45c5be99d08 10.0 landed
-
Introduce convenience macros to hide JsonbContainer header accesses better.
- f7c624624029 10.0 landed