Michael Tefft <[email protected]> writes:
> I would like to extract the DDL to create a given object (tables, primarily)
> from the catalog. Is there an interface, query, etc. that will do this? I'd
> rather not craft the DDL myself.
DDL isn't actually stored in the catalogs anywhere; it has to be
reconstructed. The only complete solution to that problem is embodied
in pg_dump. Hence the short answer is "extract what you need from
pg_dump output". Depending on exactly what you need, you might be able
to get pg_dump to emit only the object definition(s) you want in the
first place. Another possibility that wouldn't involve editing a large
dump file is to dump to an archive file and then use pg_restore's -l
and -L options to obtain a customized selective restore script.
regards, tom lane
--
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general