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 1pwgJU-0004Dg-NV for pgsql-hackers@arkaria.postgresql.org; Wed, 10 May 2023 09:40:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pwgJT-0005cZ-He for pgsql-hackers@arkaria.postgresql.org; Wed, 10 May 2023 09:40:47 +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 1pwgJS-0005cQ-Iq for pgsql-hackers@lists.postgresql.org; Wed, 10 May 2023 09:40:47 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pwgJN-001XZH-8v for pgsql-hackers@lists.postgresql.org; Wed, 10 May 2023 09:40:45 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id DE3445C03F3; Wed, 10 May 2023 05:40:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 10 May 2023 05:40:39 -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=1683711639; x= 1683798039; bh=55vbZc5WkcCFu+KzJ5wsHk542yp7dcU2QiQiMlimAlQ=; b=C gF/aOqyDQy2fACSZHVB1jtZeYAlj0iCGZe2qP5UoAs1A2rRakpC4ej9en+NMWeDW /PZQkaEfeD85kSJLlgce/0Wv1Ya2T7mHjs8hW4kVanATjkWJZLOZ352YE6Cc+Zw0 0OxZETGAFcm8QNt+AiLkHYKw4h6Q0s3SQo1WxnXKgNRDE9Ed/9vQuOxmsMXt+AIL Xe+aQHzZkoJYCYvoFgmih3mvtOpSKGsoD1OIrwAVh5FQxAapZz2HSIbXv6DfKowN EaZfKwT3V4L8uHobbgPit9MvXotWlXOcFCbCR9D/DKmuCBXHS5q7I1dqyvXou4pd 5i6x0vg0rrkb3ZZlKLQsg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeghedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfggtggugfgjsehtke ertddttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhr vgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvkedtffduff dtffffheffhfejjefhgfeiueeukeejkeffgfdufffhudffffeuveenucffohhmrghinhep vghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhr gh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 May 2023 05:40:39 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id A062E149; Wed, 10 May 2023 11:40:36 +0200 (CEST) Date: Wed, 10 May 2023 11:40:36 +0200 From: Alvaro Herrera To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: MERGE lacks ruleutils.c decompiling support!? Message-ID: <20230510094036.ugfnle53msarfc4n@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 BTW, I spent some time adding a cross-check to see if the code was at least approximately correct for all the queries in the MERGE regression tests, and couldn't find any failures. I then extended the test to the other optimizable commands, and couldn't find any problems there either. My approach was perhaps a bit simple-minded: I just patched pg_analyze_and_rewrite_fixedparams() to call pg_get_querydef() after parse_analyze_fixedparams(), then ran the main regression tests. No crashes. Also had it output as a WARNING together with the query_string, so that I could eyeball for any discrepancies; I couldn't find any queries that produce wrong contents, though this was just manual examination of the resulting noise logs. I suppose a better approach might be to run the query produced by pg_get_querydef() again through parse analysis and see if it produces the same; or better yet, discard the original parsed query and parse the pg_get_querydef(). I didn't try to do this. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "No deja de ser humillante para una persona de ingenio saber que no hay tonto que no le pueda enseñar algo." (Jean B. Say)