Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vx7PG-00GIT8-0r for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Mar 2026 17:50:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vx7PC-0029PF-2g for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Mar 2026 17:50:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vx7PC-0029P7-1Z for pgsql-hackers@lists.postgresql.org; Mon, 02 Mar 2026 17:50:07 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vx7PA-000000003Jk-1GLp for pgsql-hackers@lists.postgresql.org; Mon, 02 Mar 2026 17:50:06 +0000 Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id A8CD21D001E5; Mon, 2 Mar 2026 12:50:02 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Mon, 02 Mar 2026 12:50:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm2; t=1772473802; x= 1772560202; bh=Q8TxknmeVau1lvmYGp727W5pF05sudJO+691Gql+mjE=; b=P Z09kb5wEnaGO+7OzeIDcLjKmXtUSd76Pn06ShjHwIEXUn6kEH1BijTdNbqGE6Cb+ 9MKJ5lJJ2qqK6WgcHJvMiujBw7Z+WhZoWG4pN9f0pZlrzGNP31Qy3gH4jI3lqfN4 cTRpXYbVfBWd3pMS6a/ayFOrl1TTpdTWnT7Imkb4Bkybkt1GHh6p9C7QiX4Js6Y1 ml6hDOhLw0wHEAaVbCdWI7KRJTw0h6NUkmJtQRO25eV2jisrVsOOWWxEY2NHQMGa jTXwQ2dEJ9r/PzsFtb+Nh8XkmPbeHLgK+4Xxt5TL6bsN/+X9Dnb08TICALLzK4iZ Xn8Dgq+cqgUqlHdvU62UA== 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:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1772473802; x=1772560202; bh=Q 8TxknmeVau1lvmYGp727W5pF05sudJO+691Gql+mjE=; b=YnL0R7epuNDK1v70j P3vYl40HGCQtT7GZv8GeLjkjXQVhWSp3Aam+nFm76DNl+vTlk3H3XJUyzA9OIisQ YB9RHedFbfMteEtEdNXzYIogO6ZlSvhyH24C4O1hj4isgFMnpd6i8J49GdltnaX9 SsR5gomA8jj0sgGDxD2IS74lvU1Rq7LC1J3MaAQO5S7t9sWSsDz+EQro7pOmB7cV Wcd+uuQuWizodJ13SAYKvHjXy72LGDc4cDWfdY79xBO+nMidrp6ZQL1CT7mhRsFt bRhRSY+xoitGgQrmNu5gAK2l7QyX1xNA3K6RaDUz7MTarO2c31Qcng0XpbG4uM/R QVwAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvheekfedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpedtvdekhefghfeuffeltdetgeeifffhteeiteeftddvffefhfeggeek heefgfejhfenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmpdhpohhsth hgrhdrvghsnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mheprghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvpdhnsggprhgtphhtthhopeegpd hmohguvgepshhmthhpohhuthdprhgtphhtthhopehhrghrihhtrggshhduleelvdesghhm rghilhdrtghomhdprhgtphhtthhopehirhhiohhnrhesghhmrghilhdrtghomhdprhgtph htthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdr ohhrghdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrdhprgdruhhs X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 Mar 2026 12:50:00 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1772473799; bh=Z6YI4vbA/tqES/1LKh4sQVPLyTrzGlBVgTkwuwXIddU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=czxETeWOVtC7Rxv9HG9V/OkO2RZ1xIpBaZZ1ArY8byam0MckKnnfqS/7zTBgoy5Qk cWdcAdNgCyfwST0US3PC0QWUctqfEQSsnXH3wA18E9iknudq0rRYpohDil8tyPmMxh Jmi6bDLgC4i49pWVC2Zvs0IpQrtgTJCPWehtYr0RIkoB4E6TPPGtFkyhMbdeFQBfy0 d/r+9u5A9nYakrERrgtKlBI3TLaoShk+ldQdRtc8UQvb1LQr9uAKoqa6o2gcsW2Nfw 9bC3mVa5pA5PyV2ekI6pgln4QOQi1dW1aJPSwEe1BxT2U4dDjTlZ8gT+9kptWGfE7V /DVFLUoLBBhbw== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 826147A; Mon, 02 Mar 2026 18:49:59 +0100 (CET) Date: Mon, 2 Mar 2026 18:49:59 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Florin Irion Cc: Tom Lane , Haritabh Gupta , pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement Message-ID: <202603021736.6nix27wwg6e6@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 2026-Mar-02, Florin Irion wrote: > On 19/02/26 01:10, Tom Lane wrote: > > > This report crystallized something that's been bothering me > > about not only pg_get_domain_ddl() but all the similar patches > > that are in the queue. They are adding a large amount of new > > code that will have to be kept in sync with behavior elsewhere > > and there is basically zero forcing function to ensure that > > that happens. Even the rather-overly-voluminous test cases > > proposed for the functions cannot catch errors of omission, > > especially not future errors of omission. > > v8 adds a PL/pgSQL round-trip harness that captures DDL, drops > the domain, re-executes the DDL, and ASSERTs the regenerated DDL > is identical, any suggestions on how to improve it are welcomed. > This function can be re-used also with other get__ddl > as it accepts a parameter for the , this way we can > use some common code. Hmm, I think this is generally a useful direction, but it feels incomplete because the developer of some new DDL feature has to remember to add calls to the regress_verify_ddl_roundtrip() function in the tests somewhere. We _are_ going to forget. I think it would be more helpful to have a test module that 1. installs an event trigger on ddl_command_end for CREATE for object being created 2. runs all the tests in parallel_schedule 3. do [... something ...] with the event trigger to generate the DDL using the new functions, and compare with the object created originally. (There's a lot of handwaving here. Maybe pg_dump both and compare?) With this sort of approach, the developer of a new CREATE feature doesn't have to remember anything, because that test will break as soon as they add a test to the stock regression tests when they add some new feature that the pg_get_blah_ddl() doesn't support. The whole point is that adding something to the standard regression tests (which is something we're accustomed to doing) is enough to also cover the DDL-dumping functions. Another possibility is to use the pg_dump/t/002_pg_dump.pl database instead of the stock regression one, which is perhaps richer in object type diversity. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Fundamental layering violations tend to bite you on tender parts of your anatomy." (Tom Lane) https://postgr.es/m/2818249.1748706121@sss.pgh.pa.us