Re: pg_dump using SQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Phillip Smith" <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pg_dump using SQL
Date: 2008-03-19 03:01:53
Message-ID: 20891.1205895713@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Phillip Smith" <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au> 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message hubert depesz lubaczewski 2008-03-19 09:59:41 Re: Create on insert a unique random number
Previous Message Phillip Smith 2008-03-18 23:24:11 Re: pg_dump using SQL