pgsql: Fix bogus optimization in JSONB containment tests.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix bogus optimization in JSONB containment tests.
Дата
Msg-id E1Xd1B3-0000Hn-SO@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix bogus optimization in JSONB containment tests.

When determining whether one JSONB object contains another, it's okay to
make a quick exit if the first object has fewer pairs than the second:
because we de-duplicate keys within objects, it is impossible that the
first object has all the keys the second does.  However, the code was
applying this rule to JSONB arrays as well, where it does *not* hold
because arrays can contain duplicate entries.  The test was really in
the wrong place anyway; we should do it within JsonbDeepContains, where
it can be applied to nested objects not only top-level ones.

Report and test cases by Alexander Korotkov; fix by Peter Geoghegan and
Tom Lane.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/86b889494a71bd6c9574de04d6612d367bc5a423

Modified Files
--------------
src/backend/utils/adt/jsonb_op.c      |   10 ++++-----
src/backend/utils/adt/jsonb_util.c    |   16 +++++++++++++--
src/test/regress/expected/jsonb.out   |   36 +++++++++++++++++++++++++++++++++
src/test/regress/expected/jsonb_1.out |   36 +++++++++++++++++++++++++++++++++
src/test/regress/sql/jsonb.sql        |    7 +++++++
5 files changed, 97 insertions(+), 8 deletions(-)


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Remove unnecessary initialization of local variables.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix bogus optimization in JSONB containment tests.