Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qiXs7-006nzk-DV for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Sep 2023 10:22:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qiXs6-008hak-3l for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Sep 2023 10:22:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qiXop-008eFX-W4 for pgsql-hackers@lists.postgresql.org; Tue, 19 Sep 2023 10:19:00 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qiXom-0065Us-8M for pgsql-hackers@postgresql.org; Tue, 19 Sep 2023 10:18:59 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id EAB8C320005D; Tue, 19 Sep 2023 06:18:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 19 Sep 2023 06:18:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1695118732; x= 1695205132; bh=wHuO0ywokrYDwkgjheJP4+9qXT5AWbEIRSWv2Xg9zq0=; b=p aG9YP9oLW2ZwQC6vEZqr6MQiX5BXmR2zko6mpsYCBICKjgspEUoa75vqpqnF8T5b NU6P1xc/UezK5zu+T3ro2SUJ8nbcJn2jlbDgffCaS5iuCQIRQjC9KByrVexgXPnv G4MX5YNyFK8Z+JQ6FUZL2aIxHhgK3rs09MLAu4JZ8fqu3WRxNI+RCtM001C4P5FB 2g8Y+QCCg8O/oRul8b8mS0OAbicqCJk9cb6N/MlUidJH889zQdkCqg5h7rA82cQZ aDK3B5FnNiqC08wLWdfJZ46B5xOmdvUBFK485flDDbb5Ti1B2FWlx/xQW3AJbXAs IXqPbcT5Jc4k6NU6Gz3AA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudektddgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesmhekreertddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepleeutedthfehieefhfeikeeuffdvuedvhfejheegfefh teeuteetgedvgfelheejnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh dpphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Sep 2023 06:18:51 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 23727C5; Tue, 19 Sep 2023 12:18:49 +0200 (CEST) Date: Tue, 19 Sep 2023 12:18:49 +0200 From: Alvaro Herrera To: Amit Langote Cc: Erik Rijkers , jian he , Andrew Dunstan , PostgreSQL-development Subject: Re: remaining sql/json patches Message-ID: <202309191018.ahnhrmu4etvl@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="mkj74lq77lmcmyqc" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --mkj74lq77lmcmyqc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 0001: I wonder why you used Node for the ErrorSaveContext pointer instead of the specific struct you want. I propose the attached, for some extra type-safety. Or did you have a reason to do it that way? -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "How amazing is that? I call it a night and come back to find that a bug has been identified and patched while I sleep." (Robert Davidson) http://archives.postgresql.org/pgsql-sql/2006-03/msg00378.php --mkj74lq77lmcmyqc Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-0001-fixup-use-struct-ErrorSaveContext-not-Node.notpatch" From 4cd888cd7abbfb156bad26bc94658be3e286bf1f Mon Sep 17 00:00:00 2001 From: Alvaro Herrera 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 --mkj74lq77lmcmyqc--