hi.

+ /*
+ * Set information for RETURNING type's input function used by
+ * ExecEvalJsonExprCoercion().
+ */
"ExecEvalJsonExprCoercion" comment is wrong?

+ /*
+ * Step to jump to the EEOP_JSONEXPR_FINISH step skipping over item
+ * coercion steps that will be added below, if any.
+ */
"EEOP_JSONEXPR_FINISH" comment is wrong?

seems on error, on empty behavior have some issues. The following are
tests for json_value.
select  json_value(jsonb '{"a":[123.45,1]}', '$.z' returning text
error on error);
select  json_value(jsonb '{"a":[123.45,1]}', '$.z' returning text
error on empty); ---imho, this should fail?
select  json_value(jsonb '{"a":[123.45,1]}', '$.z' returning text
error on empty error on error);

I did some minor refactoring, please see the attached.
In transformJsonFuncExpr, only (jsexpr->result_coercion) is not null
then do InitJsonItemCoercions.
The ExecInitJsonExpr ending part is for Adjust EEOP_JUMP steps. so I
moved "Set information for RETURNING type" inside
if (jexpr->result_coercion || jexpr->omit_quotes).
there are two if (jexpr->item_coercions). so I combined them together.

Attachment: ExecInitJsonExpr_minor_refactor.nocfbot
Description: Binary data

Reply via email to