two JsonCoercionState in src/tools/pgindent/typedefs.list. +JsonCoercionState JsonConstructorExpr JsonConstructorExprState JsonConstructorType JsonEncoding +JsonExpr +JsonExprOp +JsonExprPostEvalState +JsonExprState +JsonCoercionState
+ post_eval->jump_eval_coercion = jsestate->jump_eval_result_coercion; + if (jbv == NULL) + { + /* Will be coerced with result_coercion. */ + *op->resvalue = (Datum) 0; + *op->resnull = true; + } + else if (!error && !empty) + { + Assert(jbv != NULL); the above "Assert(jbv != NULL);" will always be true? based on: json_behavior_clause_opt: json_behavior ON EMPTY_P { $$ = list_make2($1, NULL); } | json_behavior ON ERROR_P { $$ = list_make2(NULL, $1); } | json_behavior ON EMPTY_P json_behavior ON ERROR_P { $$ = list_make2($1, $4); } | /* EMPTY */ { $$ = list_make2(NULL, NULL); } ; so + if (func->behavior) + { + on_empty = linitial(func->behavior); + on_error = lsecond(func->behavior); + } `if (func->behavior)` will always be true? By the way, in the above "{ $$ = list_make2($1, $4); }" what does $4 refer to? (I don't know gram.y....) + jsexpr->formatted_expr = transformJsonValueExpr(pstate, constructName, + func->context_item, + JS_FORMAT_JSON, + InvalidOid, false); + + Assert(jsexpr->formatted_expr != NULL); This Assert is unnecessary? transformJsonValueExpr function already has an assert in the end, will it fail that one first?