aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-01-20 14:26:56 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-01-20 14:26:56 -0500
commit31f403e95fdf88338d3fc9c6af80fcf6d8241044 (patch)
tree534d3cd8eeb281986ae27b80a29b3a03fa06b692 /src/backend/utils/adt/jsonfuncs.c
parentcd23a2019c4b8da47905e91c8a841cadac978a32 (diff)
downloadpostgresql-31f403e95fdf88338d3fc9c6af80fcf6d8241044.tar.gz
postgresql-31f403e95fdf88338d3fc9c6af80fcf6d8241044.zip
Further tweaking of jsonb_set_lax().
Some buildfarm members were still warning about this, because in 9c679a08f I'd missed decorating one of the ereport() code paths with a dummy return. Also, adjust the error messages to be more in line with project style guide.
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
-rw-r--r--src/backend/utils/adt/jsonfuncs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 3c1a0319fe9..38758a626b2 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -4415,7 +4415,7 @@ jsonb_set_lax(PG_FUNCTION_ARGS)
if (PG_ARGISNULL(4))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("need delete_key, return_target, use_json_null, or raise_exception")));
+ errmsg("null_value_treatment must be \"delete_key\", \"return_target\", \"use_json_null\", or \"raise_exception\"")));
/* if the new value isn't an SQL NULL just call jsonb_set */
if (! PG_ARGISNULL(2))
@@ -4428,9 +4428,10 @@ jsonb_set_lax(PG_FUNCTION_ARGS)
{
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("NULL is not allowed"),
- errdetail("exception raised due to \"null_value_treatment => 'raise_exception'\""),
- errhint("to avoid, either change the null_value_treatment argument or ensure that an SQL NULL is not used")));
+ errmsg("JSON value must not be null"),
+ errdetail("Exception was raised because null_value_treatment is \"raise_exception\"."),
+ errhint("To avoid, either change the null_value_treatment argument or ensure that an SQL NULL is not passed.")));
+ return (Datum) 0; /* silence stupider compilers */
}
else if (strcmp(handle_val, "use_json_null") == 0)
{
@@ -4455,7 +4456,7 @@ jsonb_set_lax(PG_FUNCTION_ARGS)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("need delete_key, return_target, use_json_null, or raise_exception")));
+ errmsg("null_value_treatment must be \"delete_key\", \"return_target\", \"use_json_null\", or \"raise_exception\"")));
return (Datum) 0; /* silence stupider compilers */
}
}