pgsql: Fix handling of nested JSON objects in json_populate_recordset a

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix handling of nested JSON objects in json_populate_recordset a
Дата
Msg-id E1Wzeje-00066T-8j@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix handling of nested JSON objects in json_populate_recordset and friends.

populate_recordset_object_start() improperly created a new hash table
(overwriting the link to the existing one) if called at nest levels
greater than one.  This resulted in previous fields not appearing in
the final output, as reported by Matti Hameister in bug #10728.
In 9.4 the problem also affects json_to_recordset.

This perhaps missed detection earlier because the default behavior is to
throw an error for nested objects: you have to pass use_json_as_text = true
to see the problem.

In addition, fix query-lifespan leakage of the hashtable created by
json_populate_record().  This is pretty much the same problem recently
fixed in dblink: creating an intended-to-be-temporary context underneath
the executor's per-tuple context isn't enough to make it go away at the
end of the tuple cycle, because MemoryContextReset is not
MemoryContextResetAndDeleteChildren.

Michael Paquier and Tom Lane

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/57d8c1270e1538d1f02e4fa1cdb1d8ded82f7c70

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c    |   28 ++++++++++++++++++++++------
src/test/regress/expected/json.out   |   15 +++++++++++++++
src/test/regress/expected/json_1.out |   15 +++++++++++++++
src/test/regress/sql/json.sql        |    6 ++++++
4 files changed, 58 insertions(+), 6 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: pgsql: pg_upgrade: remove pg_multixact files left by initdb
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix handling of nested JSON objects in json_populate_recordset a