SQL/JSON: Fix error-handling of some JsonBehavior expressions

Amit Langote <amitlan@postgresql.org>

Commit: 63e6c5f4a2eeb22e0dd446a62c2b4b417d2b51f0
Author: Amit Langote <amitlan@postgresql.org>
Date: 2024-07-26T07:00:06Z
Releases: 18.0
SQL/JSON: Fix error-handling of some JsonBehavior expressions

To ensure that the errors of executing a JsonBehavior expression that
is coerced in the parser are caught instead of being thrown directly,
pass ErrorSaveContext to ExecInitExprRec() when initializing it.
Also, add a EEOP_JSONEXPR_COERCION_FINISH step to handle the errors
that are caught that way.

Discussion: https://postgr.es/m/CACJufxEo4sUjKCYtda0_qt9tazqqKPmF1cqhW9KBOUeJFqQd2g@mail.gmail.com
Backpatch-through: 17

Files

Discussion