if (val_type == InvalidOid || val_type == UNKNOWNOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("arg 1: could not determine data type")));
+ errmsg("could not determine data type for argument %d", 1)));
add_json(arg, false, state, val_type, true);
if (val_type == InvalidOid || val_type == UNKNOWNOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("arg 2: could not determine data type")));
+ errmsg("could not determine data type for argument %d", 2)));
add_json(arg, PG_ARGISNULL(2), state, val_type, false);
if (nargs % 2 != 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("invalid number or arguments: object must be matched key value pairs")));
+ errmsg("invalid number or arguments"),
+ errhint("Object must be matched key value pairs.")));
result = makeStringInfo();
if (PG_ARGISNULL(i))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("arg %d: key cannot be null", i + 1)));
+ errmsg("argument %d cannot be null", i + 1),
+ errhint("Object keys should be text.")));
val_type = get_fn_expr_argtype(fcinfo->flinfo, i);
/*
if (val_type == InvalidOid || val_type == UNKNOWNOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("arg %d: could not determine data type", i + 1)));
+ errmsg("could not determine data type for argument %d",
+ i + 1)));
appendStringInfoString(result, sep);
sep = ", ";
add_json(arg, false, result, val_type, true);
if (val_type == InvalidOid || val_type == UNKNOWNOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("arg %d: could not determine data type", i + 2)));
+ errmsg("could not determine data type for argument %d",
+ i + 2)));
add_json(arg, PG_ARGISNULL(i + 1), result, val_type, false);
}
if (val_type == InvalidOid || val_type == UNKNOWNOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("arg %d: could not determine data type", i + 1)));
+ errmsg("could not determine data type for argument %d",
+ i + 1)));
appendStringInfoString(result, sep);
sep = ", ";
add_json(arg, PG_ARGISNULL(i), result, val_type, false);
-- keys must be scalar and not null
SELECT json_build_object(null,2);
-ERROR: arg 1: key cannot be null
+ERROR: argument 1 cannot be null
+HINT: Object keys should be text.
SELECT json_build_object(r,2) FROM (SELECT 1 AS a, 2 AS b) r;
ERROR: key value must be scalar, not array, composite, or json
SELECT json_build_object(json '{"a":1,"b":2}', 3);