Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5tuC-0004Dg-Kj for pgsql-gui-dev@arkaria.postgresql.org; Mon, 18 Mar 2019 15:10:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h5tu9-00075S-Ra for pgsql-gui-dev@arkaria.postgresql.org; Mon, 18 Mar 2019 15:10:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5tu9-00075L-MY for pgsql-gui-dev@lists.postgresql.org; Mon, 18 Mar 2019 15:10:21 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5tu7-0007vO-6t for pgsql-gui-dev@lists.postgresql.org; Mon, 18 Mar 2019 15:10:21 +0000 Received: from msg.df7cb.de (unknown [IPv6:2003:5b:203b:100:7627:eaff:fe52:8e03]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 44NKP60NwVz3F0j for ; Mon, 18 Mar 2019 16:10:18 +0100 (CET) Date: Mon, 18 Mar 2019 16:10:17 +0100 From: Christoph Berg To: pgsql-gui-dev@lists.postgresql.org Subject: Re: Export the CREATE TABLE command in pure SQL Message-ID: <20190318151017.GE3087@msg.df7cb.de> References: <2bc470194b4837c1f733a4e05f569bc6@dalibo.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2bc470194b4837c1f733a4e05f569bc6@dalibo.info> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Re: Damien Clochard 2019-03-17 <2bc470194b4837c1f733a4e05f569bc6@dalibo.info> > How do you guys deal with this ? It seems that a lot of GUI tools are able > to "export the table structure".... Is there an extension somewhere to do > that ? Is it possible to write i in pure SQL ? If yes, there anybody here > interested in joining forces to build a shared export function ? IMHO the cleanest way would be to move all of that into the server. There are already functions like pg_getindexdef() which pg_dump can (could?) use. But of course that won't fix the problem for existing PG versions. For a medium-term solution, a plpgsql extension (or the client-side equivalent) seems like the best way. Christoph