PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> When an SQL/JSON function's path expression is a NULL jsonpath constant,
> `contain_mutable_functions()` wrongly reports the whole expression as
> immutable, so VOLATILE sub-expressions in the same JsonExpr (RETURNING
> coercion, PASSING values, DEFAULT/ON ERROR expressions) escape the
> check.
Yup, clearly a thinko, thanks for the report.
regards, tom lane