From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix json_to_record() bug with nested objects. |
Date: | 2016-03-03 04:31:59 |
Message-ID: | E1abKvf-0007oW-Jd@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix json_to_record() bug with nested objects.
A thinko concerning nesting depth caused json_to_record() to produce bogus
output if a field of its input object contained a sub-object with a field
name matching one of the requested output column names. Per bug #13996
from Johann Visagie.
I added a regression test case based on his example, plus parallel tests
for json_to_recordset, jsonb_to_record, jsonb_to_recordset. The latter
three do not exhibit the same bug (which suggests that we may be missing
some opportunities to share code...) but testing seems like a good idea
in any case.
Back-patch to 9.4 where these functions were introduced.
Branch
------
REL9_4_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/597e41e45eec8038b8c2c1153d1d050bfafeacbf
Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c | 2 +-
src/test/regress/expected/json.out | 16 ++++++++++++++++
src/test/regress/expected/jsonb.out | 16 ++++++++++++++++
src/test/regress/sql/json.sql | 9 ++++++++-
src/test/regress/sql/jsonb.sql | 8 ++++++++
5 files changed, 49 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2016-03-03 07:46:09 | pgsql: logical decoding: fix decoding of a commit's commit time. |
Previous Message | Tom Lane | 2016-03-02 22:38:03 | pgsql: Create stub functions to support pg_upgrade of old contrib/tsear |