ddl_versioning
ddl_versioning · DDL object versioning with event triggers for tables, indexes, functions, and views.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100977 | ddl_versioning | ddl_versioning | 1.0 | ADMIN | GPL-3.0 | SQL |
PostgreSQL · 13, 14, 15, 16, 17, 18
Usage
Sources:
ddl_versioning records successive textual definitions of selected database objects whenever a supported DDL command finishes. It is useful as a lightweight audit aid for tables, indexes, functions, and views, but it is not a complete schema-backup or rollback system.
Core workflow
The extension is trusted, fixed to the public schema, and not relocatable:
The database-wide ddl_versioning_trigger event trigger runs on ddl_command_end. Inspect the object catalog and its saved versions as follows:
Recorded objects
- Tables are reconstructed by
ddl_versioning_get_tabledef; indexes, including separately created constraints and indexes, are recorded independently. - Indexes use
pg_get_indexdef, functions usepg_get_functiondef, and views usepg_get_viewdef. - Other DDL tags can reach the event trigger, but unsupported object types are logged rather than converted into restorable definitions.
Each supported DDL command appends another row. The extension provides no retention policy, comparison UI, replay procedure, or automatic rollback, so prune history and build restore tooling separately if required. Table reconstruction does not capture every schema property as a self-contained migration; test any generated definition before using it for recovery. The global event trigger also adds writes and logging to DDL operations, so evaluate its overhead and permissions on the target PostgreSQL release.