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 1puyBj-0008RE-Om for pgsql-hackers@arkaria.postgresql.org; Fri, 05 May 2023 16:21:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1puyBi-000247-Nb for pgsql-hackers@arkaria.postgresql.org; Fri, 05 May 2023 16:21:42 +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 1puyBh-00023E-O9 for pgsql-hackers@lists.postgresql.org; Fri, 05 May 2023 16:21:42 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1puyBd-000lIF-3G for pgsql-hackers@lists.postgresql.org; Fri, 05 May 2023 16:21:41 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 3D03332000F9; Fri, 5 May 2023 12:21:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 05 May 2023 12:21:33 -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=fm3; t=1683303692; x= 1683390092; bh=r+cLbOaxW7f2FLismAHrSafWYTHHqptW+cmJh976zcU=; b=A I9rgnA50kTSBDAQL4nbmxam0ireqf4n69ocLomye0NxZLUS12wkfeJCbGswASuAS k/+s+Ts87sPzsymlsEFJ6e6nBUY1KEyAMZIU9sGj/xNIBpMRNv1XISWZpGRMI+Aj Zps1+7glLyWu6Dekbj8x12iITsOn04ZxWIPnMSpdkQO4QJTY5DFnjs1ytiNKDCCl fOrCppI6oV2uLsNrQOD9mgAEbLxl6V9K+3B6jD1RiVG/KPrFHgwaoShH4DmG8JiO A8qn593RxwGoVTTJyV7AitgADUfLGqBcJTsbwQ12YksWblbSmtVjnMVHTvgrTUVs DG7yJ26MukOu0oAYxMXtw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeefvddguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvfevuffkgggtugfgjgesth ekredttddtjeenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghr rhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdektdffud fftdffffehfffhjeejhffgieeuueekjeekfffgudffhfduffffueevnecuffhomhgrihhn pegvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdho rhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 5 May 2023 12:21:32 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 4DB7DA0; Fri, 5 May 2023 18:21:30 +0200 (CEST) Date: Fri, 5 May 2023 18:21:30 +0200 From: Alvaro Herrera To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: MERGE lacks ruleutils.c decompiling support!? Message-ID: <20230505162130.jcotfjoklniro2iq@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3579737.1683293801@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-May-05, Tom Lane wrote: > I made this function: > > CREATE OR REPLACE FUNCTION test_fun() > RETURNS void > LANGUAGE SQL > BEGIN ATOMIC > MERGE INTO target > USING source s on s.id = target.id > WHEN MATCHED THEN > UPDATE SET data = s.data > WHEN NOT MATCHED THEN > INSERT VALUES (s.id, s.data); > end; > > It appears to work fine, but: > > regression=# \sf+ test_fun() > ERROR: unrecognized query command type: 5 > > and it also breaks pg_dump. Somebody screwed up pretty badly > here. Is there any hope of fixing it for Monday's releases? > > (I'd guess that decompiling the WHEN clause would take a nontrivial > amount of new code, so maybe fixing it on such short notice is > impractical. But ugh.) Hmm, there is *some* code in ruleutils for MERGE, but clearly something is missing. Let me have a look ... -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/