Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 84B05B5DCE3 for ; Wed, 13 Jul 2011 19:16:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 91365-02 for ; Wed, 13 Jul 2011 22:16:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd-17937.dedibox.fr (sd-17937.dedibox.fr [88.191.100.74]) by mail.postgresql.org (Postfix) with ESMTP id 33444B5DCDF for ; Wed, 13 Jul 2011 19:16:07 -0300 (ADT) Received: from [192.168.10.3] (ASte-Genev-Bois-153-1-5-206.w83-112.abo.wanadoo.fr [83.112.67.206]) by sd-17937.dedibox.fr (Postfix) with ESMTPA id B18533B8F5; Thu, 14 Jul 2011 00:16:06 +0200 (CEST) Subject: Re: Looking for a "show create table " equivalent From: Guillaume Lelarge To: "B.Rathmann" Cc: pgsql-sql@postgresql.org Date: Thu, 14 Jul 2011 00:16:06 +0200 In-Reply-To: <4E1C06BD.5080606@ping.de> References: <4E1C06BD.5080606@ping.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.0.2 (3.0.2-3.fc15) Content-Transfer-Encoding: 7bit Message-ID: <1310595366.3546.3.camel@laptop> Mime-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201107/72 X-Sequence-Number: 35642 On Tue, 2011-07-12 at 10:33 +0200, B.Rathmann wrote: > [...] > I've been trying to find out how to find out which sql was run to create > a certain table. As I need this in a program which may access the > database remotely, using pg_dump --schema-only or psql is not an option > (the system my program runs on may not even have those tools installed). > Looking at the source of pgadmin3 it seems as if the program collects > all info about the given table (columns, indeces etc) and creates the > needed SQL by itself, is there no easier way? > No. pgAdmin does it this way because it has no other way to do it. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com