index 299b2a25ddbc905428f1588e0e29063eccedcf2b..2f99908fd3fce5e2ae33b7770b7e2115cc227a97 100644 (file)
errmsg("null value not allowed for object key")));
v = TextDatumGetCString(in_datums[i * 2]);
- if (v[0] == '0円')
- ereport(ERROR,
- (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("empty value not allowed for object key")));
if (i > 0)
appendStringInfoString(&result, ", ");
escape_json(&result, v);
errmsg("null value not allowed for object key")));
v = TextDatumGetCString(key_datums[i]);
- if (v[0] == '0円')
- ereport(ERROR,
- (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("empty value not allowed for object key")));
if (i > 0)
appendStringInfoString(&result, ", ");
escape_json(&result, v);
index cd6ea5b12d542cf697a33e7fe3dc0a35c2f5fafd..de4d49d5b2d267145394ee8f37d589ff74ebce2b 100644 (file)
-- null key error
select json_object('{a,b,NULL,"d e f"}','{1,2,3,"a b c"}');
ERROR: null value not allowed for object key
--- empty key error
+-- empty key is allowed
select json_object('{a,b,"","d e f"}','{1,2,3,"a b c"}');
-ERROR: empty value not allowed for object key
+ json_object
+-----------------------------------------------------
+ {"a" : "1", "b" : "2", "" : "3", "d e f" : "a b c"}
+(1 row)
+
-- json_to_record and json_to_recordset
select * from json_to_record('{"a":1,"b":"foo","c":"bar"}')
as x(a int, b text, d text);
index 51657a8d70fb7a49c07f403bf045610b82427325..2f8e8b0a9cbbb677e5d6afd220b827eb399e2ea4 100644 (file)
-- null key error
select json_object('{a,b,NULL,"d e f"}','{1,2,3,"a b c"}');
ERROR: null value not allowed for object key
--- empty key error
+-- empty key is allowed
select json_object('{a,b,"","d e f"}','{1,2,3,"a b c"}');
-ERROR: empty value not allowed for object key
+ json_object
+-----------------------------------------------------
+ {"a" : "1", "b" : "2", "" : "3", "d e f" : "a b c"}
+(1 row)
+
-- json_to_record and json_to_recordset
select * from json_to_record('{"a":1,"b":"foo","c":"bar"}')
as x(a int, b text, d text);
index 3215b61a5a81100546ed415f15ddebfb8020b3db..ae65ef6921ebec9d1839f4f07eae42d2412bc4e6 100644 (file)
@@ -435,7 +435,7 @@ select json_object('{a,b,c,"d e f"}','{1,2,3,"a b c",g}');
select json_object('{a,b,NULL,"d e f"}','{1,2,3,"a b c"}');
--- empty key error
+-- empty key is allowed
select json_object('{a,b,"","d e f"}','{1,2,3,"a b c"}');