Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id F0D0C2E01A5 for ; Wed, 19 Mar 2008 02:08:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 91740-01-3 for ; Wed, 19 Mar 2008 02:08:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A75782E0209 for ; Wed, 19 Mar 2008 00:01:54 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m2J31rRY020892; Tue, 18 Mar 2008 23:01:53 -0400 (EDT) To: "Phillip Smith" cc: pgsql-sql@postgresql.org Subject: Re: pg_dump using SQL In-reply-to: <001b01c8894f$2c2ae710$9b0014ac@wbaus090> References: <001b01c8894f$2c2ae710$9b0014ac@wbaus090> Comments: In-reply-to "Phillip Smith" message dated "Wed, 19 Mar 2008 10:24:11 +1100" Date: Tue, 18 Mar 2008 23:01:53 -0400 Message-ID: <20891.1205895713@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/118 X-Sequence-Number: 30446 "Phillip Smith" writes: >> Is there any way to do what pg_dump does?, I mean, get the structure of a >> table in a database (ex: CREATE TABLE ...) > Turn Query Logging on in postgresql.conf then see what queries are executed > by pgAdmin or similar when you run it? But note that these queries are moving targets: they frequently change from one PG version to the next. By far the best answer, if you can use it, is to invoke pg_dump itself as a subprocess. Something like "pg_dump -s -t mytable ..." for instance. regards, tom lane