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 1nAvzJ-0007HR-3A for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Jan 2022 15:38:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nAvzH-00081z-Vd for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Jan 2022 15:38:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nAvzH-00081q-ML for pgsql-hackers@lists.postgresql.org; Fri, 21 Jan 2022 15:38:03 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nAvzE-0002Sq-9a for pgsql-hackers@lists.postgresql.org; Fri, 21 Jan 2022 15:38:03 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 623665C04A4; Fri, 21 Jan 2022 10:37:58 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 21 Jan 2022 10:37:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date: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= fm1; bh=yzxlWuM3IbhSXkzbcjkDQvjn2S0srRCEyPAQpRh5FEo=; b=Ydl9yOzq FLls13DMCXwLMIh0rjd7UsXndZp/ylH4yhwfjYdd1/Y6h8SooLAkFtpAlkyV9IGE Ihcf4Nkvm8+sZp3objFmwbRTNDeu/OV6yOJ8at840qcGhowmlJgd05J4Mzz/ZWQx iyeXRVYS9ie2hU93DiCha8l0Fzgh3HfZF4mbF0K+P+WFjqDxthssvUJET4ez3Gvv 7GhWLLCSQRGyfp/v23R0bhFGWHD7k1TILocGm7Z7h6de1KCBeM+qjzdCBBMlMUZC pGadN3V47boGgJwpu9KabNn6IfI7iu4De6IIzjb8L+tc7xCPr5WFTNAcfTAqf1Rb OQciBfQHzV5hqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrvddtgdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepudejveejffejveduudetvdekieeuiedtvdeileefkeevjedu feeguedvjefhueelnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 21 Jan 2022 10:37:57 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id A2AB52A07D3; Fri, 21 Jan 2022 12:37:53 -0300 (-03) Date: Fri, 21 Jan 2022 12:37:53 -0300 From: Alvaro Herrera To: Japin Li Cc: Pg Hackers , Simon Riggs , Tomas Vondra , Zhihong Yu , Daniel Westermann , Amit Langote , Justin Pryzby , Erik Rijkers , Jaime Casanova Subject: Re: support for MERGE Message-ID: <202201211537.veim2rt3asdb@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 2022-Jan-21, Japin Li wrote: > + /* > + * NOT MATCHED actions can't see target relation, but they can see > + * source relation. > + */ > + Assert(mergeWhenClause->commandType == CMD_INSERT || > + mergeWhenClause->commandType == CMD_DELETE || > + mergeWhenClause->commandType == CMD_NOTHING); > + setNamespaceVisibilityForRTE(pstate->p_namespace, > + targetRelRTE, false, false); > + setNamespaceVisibilityForRTE(pstate->p_namespace, > + sourceRelRTE, true, true); > > Should we remove the CMD_DELETE from Assert(), since it will not happened > according to MERGE syntax? Absolutely --- silly copy&paste mistake. Pushed fix. -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/ "Ni aún el genio muy grande llegaría muy lejos si tuviera que sacarlo todo de su propio interior" (Goethe)