Re: pg_dump using SQL - Mailing list pgsql-sql

From Tom Lane
Subject Re: pg_dump using SQL
Date
Msg-id 20891.1205895713@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_dump using SQL  ("Phillip Smith" <phillip.smith@weatherbeeta.com.au>)
List pgsql-sql
"Phillip Smith" <phillip.smith@weatherbeeta.com.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


pgsql-sql by date:

Previous
From: "Phillip Smith"
Date:
Subject: Re: pg_dump using SQL
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: Create on insert a unique random number