Received: from maia.hub.org (unknown [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id AF356B5DD8E for ; Thu, 14 Jul 2011 10:42:25 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 99886-06 for ; Thu, 14 Jul 2011 13:39:48 +0000 (UTC) Received: from mx1.hub.org (mx1.hub.org [200.46.208.106]) by mail.postgresql.org (Postfix) with ESMTP id 4A5DFB5DD5C for ; Thu, 14 Jul 2011 10:00:36 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.hub.org (Postfix) with ESMTP id 3950C27FBA7B for ; Thu, 14 Jul 2011 10:00:23 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QhLWf-0007eU-Pg for pgsql-sql@postgresql.org; Thu, 14 Jul 2011 15:00:21 +0200 Received: from ip-118-90-68-18.xdsl.xnet.co.nz ([118.90.68.18]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Jul 2011 15:00:21 +0200 Received: from jasen by ip-118-90-68-18.xdsl.xnet.co.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 14 Jul 2011 15:00:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Jasen Betts Subject: Re: Looking for a "show create table " equivalent Date: 14 Jul 2011 10:22:14 GMT Organization: Dis (not Dat) Organisation Lines: 34 Message-ID: References: <4E1C06BD.5080606@ping.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ip-118-90-68-18.xdsl.xnet.co.nz X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, NO_DNS_FOR_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201107/76 X-Sequence-Number: 35646 On 2011-07-12, B.Rathmann wrote: > Hello, > > I've been trying to find out how to find out which sql was run to create > a certain table. That's like trying to find what change was used to create $1.83 there several possible answers all but one of them wrong, but many of them may . > 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). why do you think you need this information? > 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? > > E.g. MySQL offers a simple "show create table ". I am using > Postgresql 9.0.4 on Gentoo. can you find what you need to know in the information schema? http://www.postgresql.org/docs/8.4/static/information-schema.html It's an industry standard, and thus should work with every SQL database. -- ⚂⚃ 100% natural