From 399274f1186da19d84164f48971a0fb7da20ae12 Mon Sep 17 00:00:00 2001
From: Amit Langote <amitlan@postgresql.org>
Date: Thu, 25 Jul 2024 23:02:11 +0900
Subject: [PATCH 5/5] SQL/JSON: Remove useless code in ExecInitJsonExpr

The code was for adding an JUMP to the next step, which is
unnecessary.

Reported-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxEo4sUjKCYtda0_qt9tazqqKPmF1cqhW9KBOUeJFqQd2g@mail.gmail.com
---
 src/backend/executor/execExpr.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 23d907451d..b614f7a4af 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -4312,21 +4312,6 @@ ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state,
 	scratch->d.constval.isnull = true;
 	ExprEvalPushStep(state, scratch);
 
-	/*
-	 * Jump to coerce the NULL using json_populate_type() if needed.  Coercing
-	 * NULL is only interesting when the RETURNING type is a domain whose
-	 * constraints must be checked.  jsexpr->use_json_coercion must have been
-	 * set in that case.
-	 */
-	if (get_typtype(jsexpr->returning->typid) == TYPTYPE_DOMAIN &&
-		DomainHasConstraints(jsexpr->returning->typid))
-	{
-		Assert(jsexpr->use_json_coercion);
-		scratch->opcode = EEOP_JUMP;
-		scratch->d.jump.jumpdone = state->steps_len + 1;
-		ExprEvalPushStep(state, scratch);
-	}
-
 	/*
 	 * To handle coercion errors softly, use the following ErrorSaveContext to
 	 * pass to ExecInitExprRec() when initializing the coercion expressions
-- 
2.43.0

