This is a PostgreSQL extension to extract DDL of database objects in a way compatible to Oracle DBMS_METADATA package. This extension establishes a systematic approach to programmatically retrieve DDL for objects. You now have the flexibility to generate DDL for an object either from a plain SQL query or from PL/pgSQL code.
The following functions and stored procedures are implemented:
GET_DDL() This function extracts DDL of specified object.
GET_DEPENDENT_DDL() This function extracts DDL of all dependent objects of specified type for a specified base object.
GET_GRANTED_DDL() This function extracts the SQL statements to recreate granted privileges and roles for a specified grantee.
SET_TRANSFORM_PARAM() This procedure is used to customize DDL through configuring session-level transform params.
This is the initial release of this extension.
Any contribution to build a better tool is welcome. You can send your ideas, features requests or patches using the GitHub tools.
The pg_dbms_metadata extension is an original work at HexaCluster Corp. Akhil Reddy Banappagari, Avinash Vallarapu and Gilles Darold are the authors and the official maintainers.