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 1x52zN-007aOV-2N for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Sep 2026 15:16:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x52zM-00FYwr-2A for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Sep 2026 15:16:28 +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 1x52xv-00FVMj-2a for pgsql-hackers@lists.postgresql.org; Fri, 11 Sep 2026 15:14:59 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x52xq-00000004Abk-0ChR for pgsql-hackers@postgresql.org; Fri, 11 Sep 2026 15:14:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 68BFEfkH994516; Fri, 11 Sep 2026 11:14:41 -0400 From: Tom Lane To: Andres Freund cc: Robert Haas , Noah Misch , Andrew Dunstan , Melanie Plageman , gonzalemario@gmail.com, dbryan.green@gmail.com, euler@eulerto.com, pgsql-hackers@postgresql.org Subject: Re: pg_get_*_ddl() needs a redesign In-reply-to: <25geh4lsb4uwqurcvh4toqbeknjmo5arw5rdvubtghdxz2bdk3@fqenqkj464zj> References: <20260827015242.54.noahmisch@microsoft.com> <20260909172132.0a.noahmisch@microsoft.com> <640139.1788975299@sss.pgh.pa.us> <20260910035953.59.noahmisch@microsoft.com> <956966.1789102554@sss.pgh.pa.us> <25geh4lsb4uwqurcvh4toqbeknjmo5arw5rdvubtghdxz2bdk3@fqenqkj464zj> Comments: In-reply-to Andres Freund message dated "Fri, 11 Sep 2026 10:23:01 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <994514.1789139681.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 11 Sep 2026 11:14:41 -0400 Message-ID: <994515.1789139681@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2026-09-11 00:55:54 -0400, Tom Lane wrote: >> I'm a bit confused why you say that. To my mind, if we were going >> to proceed in this direction, version skew would ideally be solved >> like this: >> = >> 1. Server-side DDL-reconstruction functions only need to work with >> their particular server version; necessarily so, since that's the >> only catalog data they'll ever see. >> = >> 2. pg_dump just calls the source server's DDL-reconstruction functions >> and doesn't have to worry about version skew. > Isn't the problem with that that we occasionally need to adapt the synta= x > between versions to some degree? I think it has become less common, but = I'm a > bit sceptical that it's wise to decide we won't ever again need that... I think we try very very hard to avoid making changes that would break existing dump files. There are certainly times where we change what pg_dump prefers to output, but the server should continue to accept what pg_dump used to output (at least for quite a few years). Users don't always have the luxury of being able to follow the advice to "use the newest pg_dump to make your dump". > I wonder if the right thing here would be to separate the "metadata > collection" aspect from the "SQL generation" aspect. I.e. have a small l= ibrary > that can generate DDL statements from its inputs, without any catalog > accesses. We'd still end up - annoyingly - with two versions of the meta= data > collection (one from syscaches for the get_ddl* SQL functions, one via q= ueries > for pg_dump), but at least the SQL generation aspect would be deduplicat= ed. Hmm... regards, tom lane