@@ -1910,7 +1910,7 @@ json_object_agg_transfn(PG_FUNCTION_ARGS)
19101910 if (val_type == InvalidOid || val_type == UNKNOWNOID )
19111911 ereport (ERROR ,
19121912 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
1913- errmsg ("arg 1: could not determine data type" )));
1913+ errmsg ("could not determine data type for argument %d" , 1 )));
19141914
19151915 add_json (arg , false, state , val_type , true);
19161916
@@ -1934,7 +1934,7 @@ json_object_agg_transfn(PG_FUNCTION_ARGS)
19341934 if (val_type == InvalidOid || val_type == UNKNOWNOID )
19351935 ereport (ERROR ,
19361936 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
1937- errmsg ("arg 2: could not determine data type" )));
1937+ errmsg ("could not determine data type for argument %d" , 2 )));
19381938
19391939 add_json (arg , PG_ARGISNULL (2 ), state , val_type , false);
19401940
@@ -1980,7 +1980,8 @@ json_build_object(PG_FUNCTION_ARGS)
19801980 if (nargs % 2 != 0 )
19811981 ereport (ERROR ,
19821982 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
1983- errmsg ("invalid number or arguments: object must be matched key value pairs" )));
1983+ errmsg ("invalid number or arguments" ),
1984+ errhint ("Object must be matched key value pairs." )));
19841985
19851986 result = makeStringInfo ();
19861987
@@ -1994,7 +1995,8 @@ json_build_object(PG_FUNCTION_ARGS)
19941995 if (PG_ARGISNULL (i ))
19951996 ereport (ERROR ,
19961997 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
1997- errmsg ("arg %d: key cannot be null" , i + 1 )));
1998+ errmsg ("argument %d cannot be null" , i + 1 ),
1999+ errhint ("Object keys should be text." )));
19982000 val_type = get_fn_expr_argtype (fcinfo -> flinfo , i );
19992001
20002002 /*
@@ -2016,7 +2018,8 @@ json_build_object(PG_FUNCTION_ARGS)
20162018 if (val_type == InvalidOid || val_type == UNKNOWNOID )
20172019 ereport (ERROR ,
20182020 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
2019- errmsg ("arg %d: could not determine data type" , i + 1 )));
2021+ errmsg ("could not determine data type for argument %d" ,
2022+ i + 1 )));
20202023 appendStringInfoString (result , sep );
20212024 sep = ", " ;
20222025 add_json (arg , false, result , val_type , true);
@@ -2042,7 +2045,8 @@ json_build_object(PG_FUNCTION_ARGS)
20422045 if (val_type == InvalidOid || val_type == UNKNOWNOID )
20432046 ereport (ERROR ,
20442047 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
2045- errmsg ("arg %d: could not determine data type" , i + 2 )));
2048+ errmsg ("could not determine data type for argument %d" ,
2049+ i + 2 )));
20462050 add_json (arg , PG_ARGISNULL (i + 1 ), result , val_type , false);
20472051
20482052 }
@@ -2099,7 +2103,8 @@ json_build_array(PG_FUNCTION_ARGS)
20992103 if (val_type == InvalidOid || val_type == UNKNOWNOID )
21002104 ereport (ERROR ,
21012105 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
2102- errmsg ("arg %d: could not determine data type" , i + 1 )));
2106+ errmsg ("could not determine data type for argument %d" ,
2107+ i + 1 )));
21032108 appendStringInfoString (result , sep );
21042109 sep = ", " ;
21052110 add_json (arg , PG_ARGISNULL (i ), result , val_type , false);
0 commit comments