aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/sql/json.sql
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2016-02-21 10:30:49 -0500
committerAndrew Dunstan <andrew@dunslane.net>2016-02-21 10:40:39 -0500
commit68d68ff8333c106962d4a936e07eba24d63a2e07 (patch)
tree823804eecb2e14bc0ebd5555d898217af9c1478f /src/test/regress/sql/json.sql
parenta397f8268a6a315b8c6579124637cddc8f79ea71 (diff)
downloadpostgresql-68d68ff8333c106962d4a936e07eba24d63a2e07.tar.gz
postgresql-68d68ff8333c106962d4a936e07eba24d63a2e07.zip
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.
Diffstat (limited to 'src/test/regress/sql/json.sql')
-rw-r--r--src/test/regress/sql/json.sql6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/regress/sql/json.sql b/src/test/regress/sql/json.sql
index 0d2c139b4d1..39f1b70f4da 100644
--- a/src/test/regress/sql/json.sql
+++ b/src/test/regress/sql/json.sql
@@ -462,6 +462,12 @@ SELECT json_object_agg(name, type) FROM foo;
-- json_object
+-- empty object, one dimension
+SELECT json_object('{}');
+
+-- empty object, two dimensions
+SELECT json_object('{}', '{}');
+
-- one dimension
SELECT json_object('{a,1,b,2,3,NULL,"d e f","a b c"}');