Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nONZk-0005db-Gm for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Feb 2022 17:43:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nONZj-0004GO-5d for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Feb 2022 17:43:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nONZi-0004GC-RW for pgsql-hackers@lists.postgresql.org; Sun, 27 Feb 2022 17:43:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nONZe-0002Kl-4u for pgsql-hackers@lists.postgresql.org; Sun, 27 Feb 2022 17:43:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 21RHguwp2373868; Sun, 27 Feb 2022 12:42:56 -0500 From: Tom Lane To: Alvaro Herrera cc: Andres Freund , Pg Hackers , Simon Riggs , Tomas Vondra , Zhihong Yu , Daniel Westermann , Amit Langote , Justin Pryzby , Japin Li , Erik Rijkers , Jaime Casanova Subject: Re: support for MERGE In-reply-to: <202202271735.4o6uyat2eh7w@alvherre.pgsql> References: <202202271735.4o6uyat2eh7w@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Sun, 27 Feb 2022 14:35:13 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2373866.1645983776.1@sss.pgh.pa.us> Date: Sun, 27 Feb 2022 12:42:56 -0500 Message-ID: <2373867.1645983776@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > I think we should make a decision on code arrangement here. From my > perspective, MERGE isn't its own executor node; rather it's just another > "method" in ModifyTable. Which makes sense, given that all it does is > call parts of INSERT, UPDATE, DELETE which are the other ModifyTable > methods. Having a separate file doesn't strike me as great, but on the > other hand it's true that merely moving all the execMerge.c code into > nodeModifyTable.c makes the latter too large. However I don't want to > create a .h file that means exposing all those internal functions to the > outside world. My ideal would be to have each INSERT, UPDATE, DELETE, > MERGE as its own separate .c file, which would be #included from > nodeModifyTable.c. We don't use that pattern anywhere though. Any > opposition to that? (The prototypes for each file would have to live in > nodeModifyTable.c itself.) Yeah, I don't like that. The point of having separate .c files is that you know that there's no interactions of non-global symbols across files. This pattern breaks that assumption, making it harder to see what's connected to what; and what's it buying exactly? I'd rather keep all the ModifyTable code in one .c file, even if that one is bigger than our usual practice. regards, tom lane