pgsql: Fix treatment of nulls in jsonb_agg and jsonb_object_agg

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix treatment of nulls in jsonb_agg and jsonb_object_agg
Date: 2015-07-24 13:47:56
Message-ID: E1ZIdKO-0000Nu-9Z@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix treatment of nulls in jsonb_agg and jsonb_object_agg

The wrong is_null flag was being passed to datum_to_json. Also, null
object key values are not permitted, and this was not being checked
for. Add regression tests covering these cases, and also add those tests
to the json set, even though it was doing the right thing.

Fixes bug #13514, initially diagnosed by Tom Lane.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d9a356ff2e6bb7ed5fb1145af49fa3e51e68a98a

Modified Files
--------------
src/backend/utils/adt/jsonb.c | 12 +++++++++---
src/test/regress/expected/json.out | 21 ++++++++++++++++++++-
src/test/regress/expected/json_1.out | 21 ++++++++++++++++++++-
src/test/regress/expected/jsonb.out | 19 ++++++++++++++++++-
src/test/regress/expected/jsonb_1.out | 19 ++++++++++++++++++-
src/test/regress/sql/json.sql | 13 +++++++++++--
src/test/regress/sql/jsonb.sql | 12 +++++++++++-
7 files changed, 107 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Joe Conway 2015-07-24 19:57:08 pgsql: Make RLS work with UPDATE ... WHERE CURRENT OF
Previous Message Andres Freund 2015-07-24 09:58:06 pgsql: Fix bug around assignment expressions containing indirections.