pgsql: Fix thinko in JsObjectSize() macro.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix thinko in JsObjectSize() macro.
Date: 2017-05-29 23:29:52
Message-ID: E1dFU6i-0002b3-8B@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix thinko in JsObjectSize() macro.

The macro gave the wrong answers for a JsObject with is_json == 0:
it would return 1 if jsonb_cont == NULL, or if that wasn't NULL,
it would return 1 for any non-zero size.

We could fix that, but the only use of this macro at present is in the
JsObjectIsEmpty() macro, so it seems simpler and clearer to get rid of
JsObjectSize() and put corrected logic into JsObjectIsEmpty().

Thinko in commit cf35346e8, so no need for back-patch.

Nikita Glukhov

Discussion: https://postgr.es/m/fbd1d566-bba0-a3de-d6d0-d3b1d7c24ff2@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e45c5be99d08d7bb6708d7bb1dd0f5d99798c6aa

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-05-30 00:28:07 pgsql: Try to ensure that stats collector's receive buffer size is at l
Previous Message Tom Lane 2017-05-29 21:08:52 pgsql: Prevent running pg_resetwal/pg_resetxlog against wrong-version d