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 1pxZMt-0008Mg-8t for pgsql-general@arkaria.postgresql.org; Fri, 12 May 2023 20:27:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pxZMq-0005St-W8 for pgsql-general@arkaria.postgresql.org; Fri, 12 May 2023 20:27:57 +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 1pxZMq-0005Sk-Li for pgsql-general@lists.postgresql.org; Fri, 12 May 2023 20:27:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pxZMo-001zNz-BV for pgsql-general@lists.postgresql.org; Fri, 12 May 2023 20:27:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 34CKRpB41565716; Fri, 12 May 2023 16:27:51 -0400 From: Tom Lane To: Stephen Frost cc: Nathaniel Sabanski , pgsql-general@lists.postgresql.org Subject: Re: Adding SHOW CREATE TABLE In-reply-to: References: <7a5d6750-84fa-59b0-33c1-7a5d26b9bc74@evolvis.org> Comments: In-reply-to Stephen Frost message dated "Fri, 12 May 2023 16:14:27 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1565714.1683923271.1@sss.pgh.pa.us> Date: Fri, 12 May 2023 16:27:51 -0400 Message-ID: <1565715.1683923271@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Stephen Frost writes: > Again, would be great to see someone actually work on this. There's > already a good chunk of code in core in pg_dump and in the postgres_fdw > for doing exactly this and it'd be great to consolidate that and at the > same time expose it via SQL. Note that this is hardly new ground: we've heard more-or-less the same proposal many times before. I think the reason it's gone nowhere is that most of the existing infrastructure is either in pg_dump or designed to support pg_dump, and pg_dump is *extremely* opinionated about what it wants and how it wants the data sliced up, for very good reasons. Reconciling those requirements with a typical user's "just give me a reconstructed CREATE TABLE command" request seems fairly difficult. Also, since pg_dump will still need to support old servers, it's hard to believe we'd accept any proposal to move that functionality into the server side, which in turn means that it's not going to be an easy SQL command. These issues probably could be surmounted with enough hard work, but please understand that just coming along with a request is not going to cause it to happen. People have already done that. (Searching the mailing list archives might be edifying.) regards, tom lane