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 1mlfjS-0005R6-Nl for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Nov 2021 23:13:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mlfjR-0007Bk-O7 for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Nov 2021 23:13:17 +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 1mlfjR-00079P-DA for pgsql-hackers@lists.postgresql.org; Fri, 12 Nov 2021 23:13:17 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mlfjP-0007rj-5d for pgsql-hackers@lists.postgresql.org; Fri, 12 Nov 2021 23:13:16 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 375A15C0003; Fri, 12 Nov 2021 18:13:14 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 12 Nov 2021 18:13:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=QwOBY3s6ySviHOu9O81XBxF3A6L3m4P/tZj7NSNSTog=; b=O6OfMULm tA6jqFNgkeHfVf2RCWnqIWKp4HxxzCVb1P/XBZ4xeJ2tghBEMB7k3xM0jqD/Wfs6 w4jux8RT+2kt3YqS3tI5Ulsic+RCcTM5bGJ++kDwy2Mi2dNxGOzG6Nq/iIDKPdZz cgu5+NziIvnMl1A2TXWs089RVqATxXZ28vgdB7s4S/dEglp4iLpWKk4PaSyqcS0G wvbAQkjwAR3LeVIV4hXJ84YfaZDQSTw+eYFoAq9C++z3EYwKbMsRBWNucfRlQtcA 7q5OGHVk5cJ0LGczhoaOpEgYoY6AiW4780nYLs6RCcwI/q/R3usgpmmK+E6+8aoC /OOefs+yyblcaQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvdeggddtjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepkedukeffieeugeegvdffvdejffdvkeejheduieeufeffgffg vdeffeefveduleffnecuffhomhgrihhnpehgihhthhhusgdrtghomhdpvghnthgvrhhprh hishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 12 Nov 2021 18:13:13 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id D70082A07B8; Fri, 12 Nov 2021 20:13:10 -0300 (-03) Date: Fri, 12 Nov 2021 20:13:10 -0300 From: Alvaro Herrera To: Zhihong Yu Cc: Pg Hackers Subject: Re: support for MERGE Message-ID: <202111122313.fjhecfq6yi2v@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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 On 2021-Nov-12, Zhihong Yu wrote: > Hi, > > + skipped_path = total - insert_path - update_path - delete_path; > > Should there be an assertion that skipped_path is not negative ? Hm, yeah, added. > + * We maintain separate transaction tables for UPDATE/INSERT/DELETE since > + * MERGE can run all three actions in a single statement. Note that UPDATE > + * needs both old and new transition tables > > Should the 'transaction' in the first line be transition ? Oh, of course. Uploaded fixup commits to https://github.com/alvherre/postgres/commits/merge-15 -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/