Re: PostgreSQL counterpart to DBMS_METADATA? - Mailing list pgsql-general

From Tom Lane
Subject Re: PostgreSQL counterpart to DBMS_METADATA?
Date
Msg-id 15576.1326812603@sss.pgh.pa.us
Whole thread Raw
In response to PostgreSQL counterpart to DBMS_METADATA?  (Michael Tefft <mjtefft@hotmail.com>)
List pgsql-general
Michael Tefft <mjtefft@hotmail.com> 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

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: [GENERAL] RE: [GENERAL] PostgreSQL counterpart to DBMS_METADATA?‏
Next
From: Jeroen van Dongen
Date:
Subject: Possible bug in PL/Python?