]> granicus.if.org Git - postgresql/commit
Fix another crash in json{b}_populate_recordset and json{b}_to_recordset.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Nov 2018 20:14:01 +0000 (15:14 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Nov 2018 20:14:01 +0000 (15:14 -0500)
commit595220a3a3a89e5648b7b6be726502efdc9ec806
treecf20265c0ab1782f2f8f39a0b9765b2d61478f5a
parent2c0791376aeda0868a646d35d95f2be42ec97170
Fix another crash in json{b}_populate_recordset and json{b}_to_recordset.

populate_recordset_worker() failed to consider the possibility that the
supplied JSON data contains no rows, so that update_cached_tupdesc never
got called.  This led to a null-pointer dereference since commit 9a5e8ed28;
before that it led to a bogus "set-valued function called in context that
cannot accept a set" error.  Fix by forcing the update to happen.

Per bug #15514.  Back-patch to v11 as 9a5e8ed28 was.  (If we were excited
about the bogus error, we could perhaps go back further, but it'd take more
work to figure out how to fix it in older branches.  Given the lack of
field complaints about that aspect, I'm not excited.)

Discussion: https://postgr.es/m/15514-59d5b4c4065b178b@postgresql.org
src/backend/utils/adt/jsonfuncs.c
src/test/regress/expected/json.out
src/test/regress/expected/jsonb.out
src/test/regress/sql/json.sql
src/test/regress/sql/jsonb.sql