aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/json.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2014-07-22 11:22:47 -0400
committerAndrew Dunstan <andrew@dunslane.net>2014-07-22 11:27:31 -0400
commit4ebe3519e1c12fe02f734aa00f824833181840c7 (patch)
tree7ad188490974888365b2f00b5535ed3006d8b4fd /src/backend/utils/adt/json.c
parentd7cdf6ee36adeac9233678fb8f2a112e6678a770 (diff)
downloadpostgresql-4ebe3519e1c12fe02f734aa00f824833181840c7.tar.gz
postgresql-4ebe3519e1c12fe02f734aa00f824833181840c7.zip
Allow empty string object keys in json_object().
This makes the behaviour consistent with the json parser, other json-generating functions, and the JSON standards.
Diffstat (limited to 'src/backend/utils/adt/json.c')
-rw-r--r--src/backend/utils/adt/json.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index 299b2a25ddb..2f99908fd3f 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -2184,10 +2184,6 @@ json_object(PG_FUNCTION_ARGS)
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);
@@ -2272,10 +2268,6 @@ json_object_two_arg(PG_FUNCTION_ARGS)
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);