On Wed, Sep 16, 2026 at 10:48 AM Amit Langote <[email protected]> wrote:
>
> Hi Jian,
>
>
> I haven't looked at the patch, but could you specify whether your
> patch fixes a live bug or is an improvement you found while working on
> the linked thread?  I don't understand which is the case because your
> report doesn't have an example.
>

Apologies for the poor communication.

In src/test/regress/expected/sqljson_queryfuncs.out, we have lots of
ERROR:  could not coerce ON ERROR expression (DEFAULT) to the RETURNING type

The comments in ExecInitJsonExpr also says that, for DEFAULT expr ON ERROR and
DEFAULT expr ON EMPTY, we evaluate the DEFAULT expression in an error-soft way
*but* rethrow the error, I assume the purpose is for better error message.

However, in the master branch, there are some cases where we do not
rethrow the soft error.
For example, I believe the query below should return an ERROR.
SELECT JSON_VALUE('"a"', '$' RETURNING int DEFAULT (('a' || (random()
* 0)::int)::int + 0) ON ERROR);



--
jian
https://www.enterprisedb.com/


Reply via email to