"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