pgsql: Unpack jbvBinary objects passed to pushJsonbValue

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Unpack jbvBinary objects passed to pushJsonbValue
Date: 2015-05-22 14:33:01
Message-ID: E1Yvo0T-0004An-Kh@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Unpack jbvBinary objects passed to pushJsonbValue

pushJsonbValue was accepting jbvBinary objects passed as WJB_ELEM or
WJB_VALUE data. While this succeeded, when those objects were later
encountered in attempting to convert the result to Jsonb, errors
occurred. With this change we ghuarantee that a JSonbValue constructed
from calls to pushJsonbValue does not contain any jbvBinary objects.
This cures a problem observed with jsonb_delete.

This means callers of pushJsonbValue no longer need to perform this
unpacking themselves. A subsequent patch will perform some cleanup in
that area.

The error was not triggered by any 9.4 code, but this is a publicly
visible routine, and so the error could be exercised by third party
code, therefore backpatch to 9.4.

Bug report from Peter Geoghegan, fix by me.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/9b74f32cdbff8b9be47fc69164eae552050509ff

Modified Files
--------------
src/backend/utils/adt/jsonb_util.c | 44 ++++++++++++++++++++++++++++++++----
src/include/utils/jsonb.h | 2 +-
2 files changed, 40 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2015-05-22 16:05:36 Re: pgsql: At promotion, archive last segment from old timeline with .parti
Previous Message Fujii Masao 2015-05-22 12:42:55 pgsql: Minor enhancement of readability of ALTER TABLE syntax in the do