From 4cd888cd7abbfb156bad26bc94658be3e286bf1f Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Tue, 19 Sep 2023 12:18:03 +0200
Subject: [PATCH] 0001 fixup: use struct ErrorSaveContext, not Node

---
 src/backend/jit/llvm/llvmjit.c       | 4 ++--
 src/backend/jit/llvm/llvmjit_expr.c  | 2 +-
 src/backend/jit/llvm/llvmjit_types.c | 2 +-
 src/include/executor/execExpr.h      | 3 ++-
 src/include/jit/llvmjit.h            | 2 +-
 src/include/nodes/execnodes.h        | 3 ++-
 6 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index ef6c8361b4..431d4511c5 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -85,7 +85,7 @@ LLVMTypeRef StructExprState;
 LLVMTypeRef StructAggState;
 LLVMTypeRef StructAggStatePerGroupData;
 LLVMTypeRef StructAggStatePerTransData;
-LLVMTypeRef StructNode;
+LLVMTypeRef StructErrorSaveContext;
 
 LLVMValueRef AttributeTemplate;
 
@@ -1035,7 +1035,7 @@ llvm_create_types(void)
 	StructAggState = llvm_pg_var_type("StructAggState");
 	StructAggStatePerGroupData = llvm_pg_var_type("StructAggStatePerGroupData");
 	StructAggStatePerTransData = llvm_pg_var_type("StructAggStatePerTransData");
-	StructNode = llvm_pg_var_type("StructNode");
+	StructErrorSaveContext = llvm_pg_var_type("StructErrorSaveContext");
 
 	AttributeTemplate = LLVMGetNamedFunction(llvm_types_module, "AttributeTemplate");
 }
diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c
index 20c79dda9f..59e20ebcbd 100644
--- a/src/backend/jit/llvm/llvmjit_expr.c
+++ b/src/backend/jit/llvm/llvmjit_expr.c
@@ -1361,7 +1361,7 @@ llvm_compile_expr(ExprState *state)
 						v_params[2] = l_int32_const(ioparam);
 						v_params[3] = l_int32_const(-1);
 						v_params[4] = l_ptr_const(op->d.iocoerce.escontext,
-												  l_ptr(StructNode));
+												  l_ptr(StructErrorSaveContext));
 						/*
 						 * InputFunctionCallSafe() will writes directly into
 						 * *op->resvalue.
diff --git a/src/backend/jit/llvm/llvmjit_types.c b/src/backend/jit/llvm/llvmjit_types.c
index 36f526b374..e1e9625038 100644
--- a/src/backend/jit/llvm/llvmjit_types.c
+++ b/src/backend/jit/llvm/llvmjit_types.c
@@ -67,7 +67,7 @@ TupleTableSlot StructTupleTableSlot;
 HeapTupleTableSlot StructHeapTupleTableSlot;
 MinimalTupleTableSlot StructMinimalTupleTableSlot;
 TupleDescData StructTupleDescData;
-Node StructNode;
+ErrorSaveContext StructErrorSaveContext;
 
 
 /*
diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h
index 25d3c02dba..8dd92f8fc0 100644
--- a/src/include/executor/execExpr.h
+++ b/src/include/executor/execExpr.h
@@ -16,6 +16,7 @@
 
 #include "executor/nodeAgg.h"
 #include "nodes/execnodes.h"
+#include "nodes/miscnodes.h"
 
 /* forward references to avoid circularity */
 struct ExprEvalStep;
@@ -417,7 +418,7 @@ typedef struct ExprEvalStep
 			/* lookup and call info for result type's input function */
 			FmgrInfo   *finfo_in;
 			Oid			typioparam;
-			Node	   *escontext;
+			ErrorSaveContext *escontext;
 		}			iocoerce;
 
 		/* for EEOP_SQLVALUEFUNCTION */
diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h
index e8cdc96b2b..c22ba3787f 100644
--- a/src/include/jit/llvmjit.h
+++ b/src/include/jit/llvmjit.h
@@ -79,7 +79,7 @@ extern PGDLLIMPORT LLVMTypeRef StructExprState;
 extern PGDLLIMPORT LLVMTypeRef StructAggState;
 extern PGDLLIMPORT LLVMTypeRef StructAggStatePerTransData;
 extern PGDLLIMPORT LLVMTypeRef StructAggStatePerGroupData;
-extern PGDLLIMPORT LLVMTypeRef StructNode;
+extern PGDLLIMPORT LLVMTypeRef StructErrorSaveContext;
 
 extern PGDLLIMPORT LLVMValueRef AttributeTemplate;
 
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 57e4ca1c63..cc4ed9279c 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -34,6 +34,7 @@
 #include "fmgr.h"
 #include "lib/ilist.h"
 #include "lib/pairingheap.h"
+#include "nodes/miscnodes.h"
 #include "nodes/params.h"
 #include "nodes/plannodes.h"
 #include "nodes/tidbitmap.h"
@@ -134,7 +135,7 @@ typedef struct ExprState
 	 * Used by the callers of ExecInitExprRec() to pass the ErrorSaveContext
 	 * that they want the expression's code to use.
 	 */
-	Node	   *escontext;
+	ErrorSaveContext *escontext;
 } ExprState;
 
 
-- 
2.39.2