SQL/JSON: Fix error-handling of some JsonBehavior expressions
authorAmit Langote <[email protected]>
Fri, 26 Jul 2024 06:59:27 +0000 (15:59 +0900)
committerAmit Langote <[email protected]>
Fri, 26 Jul 2024 07:36:02 +0000 (16:36 +0900)
commit79fa052e78804667739bee3f3e220f0ef6783b2c
tree813f9647fa73d61c0307f3cd6aecfa3bc516c115
parentfacd89587141451107278601dd4d4a8c4ba5e8a8
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
src/backend/executor/execExpr.c
src/backend/executor/execExprInterp.c
src/test/regress/expected/sqljson_jsontable.out
src/test/regress/expected/sqljson_queryfuncs.out