pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix two-argument jsonb_object when called with empty arrays
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix two-argument jsonb_object when called with empty arrays
@ 2016-02-21 15:42  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Andrew Dunstan @ 2016-02-21 15:42 UTC (permalink / raw)
  To: pgsql-committers

Fix two-argument jsonb_object when called with empty arrays

Some over-eager copy-and-pasting on my part resulted in a nonsense
result being returned in this case. I have adopted the same pattern for
handling this case as is used in the one argument form of the function,
i.e. we just skip over the code that adds values to the object.

Diagnosis and patch from Michael Paquier, although not quite his
solution.

Fixes bug #13936.

Backpatch to 9.5 where jsonb_object was introduced.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/68d68ff8333c106962d4a936e07eba24d63a2e07

Modified Files
--------------
src/backend/utils/adt/jsonb.c       |  7 ++++---
src/test/regress/expected/json.out  | 14 ++++++++++++++
src/test/regress/expected/jsonb.out | 14 ++++++++++++++
src/test/regress/sql/json.sql       |  6 ++++++
src/test/regress/sql/jsonb.sql      |  6 ++++++
5 files changed, 44 insertions(+), 3 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix two-argument jsonb_object when called with empty arrays
@ 2016-02-21 15:42  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Andrew Dunstan @ 2016-02-21 15:42 UTC (permalink / raw)
  To: pgsql-committers

Fix two-argument jsonb_object when called with empty arrays

Some over-eager copy-and-pasting on my part resulted in a nonsense
result being returned in this case. I have adopted the same pattern for
handling this case as is used in the one argument form of the function,
i.e. we just skip over the code that adds values to the object.

Diagnosis and patch from Michael Paquier, although not quite his
solution.

Fixes bug #13936.

Backpatch to 9.5 where jsonb_object was introduced.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/94c745eb189e2122a3ff86c24443b11408ea2376

Modified Files
--------------
src/backend/utils/adt/jsonb.c       |  7 ++++---
src/test/regress/expected/json.out  | 14 ++++++++++++++
src/test/regress/expected/jsonb.out | 14 ++++++++++++++
src/test/regress/sql/json.sql       |  6 ++++++
src/test/regress/sql/jsonb.sql      |  6 ++++++
5 files changed, 44 insertions(+), 3 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-02-21 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-02-21 15:42 pgsql: Fix two-argument jsonb_object when called with empty arrays Andrew Dunstan <andrew@dunslane.net>
2016-02-21 15:42 pgsql: Fix two-argument jsonb_object when called with empty arrays Andrew Dunstan <andrew@dunslane.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox