pg_drop_events
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_drop_events | 0.1.0 | ADMIN | PostgreSQL | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5850 | pg_drop_events | No | No | No | Yes | No | No | public |
| Related | plpgsql table_log safeupdate pg_strict pg_savior pgmemento pgaudit pgelog block_copy_command pg_kpart data_historization |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.0 | 1817161514 | pg_drop_events | plpgsql |
| RPM | PIGSTY | 0.1.0 | 1817161514 | pg_drop_events_$v | - |
| DEB | PIGSTY | 0.1.0 | 1817161514 | postgresql-$v-pg-drop-events | - |
Build
You can build the RPM / DEB packages for pg_drop_events using pig build:
Install
You can install pg_drop_events directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
pg_drop_events: logs transaction ids of drop table, drop column, drop materialized view statements
The pg_drop_events extension uses event triggers to automatically log details about DROP operations on tables, columns, and materialized views. The logged information can be used for point-in-time recovery (PITR) after accidental drops.
Tracked Operations
DROP TABLEDROP COLUMN(viaALTER TABLE)DROP MATERIALIZED VIEW
Logged Information
| Column | Description |
|---|---|
pid | Process identifier |
usename | Database user who executed the command |
query | The SQL statement |
xact_id | Transaction identifier |
wal_position | Write-ahead log position |
objid | Object identifier |
object_name | Fully qualified name of dropped object |
object_type | Object classification (table, table column, etc.) |
xact_time | Timestamp of the transaction |
Example
Point-in-Time Recovery
The logged data maps directly to PostgreSQL recovery parameters:
| pg_drop_events column | Recovery parameter |
|---|---|
xact_id | recovery_target_xid |
xact_time | recovery_target_time |
wal_position | recovery_target_lsn |
Use these values in postgresql.conf or recovery.conf to restore the database to a point just before the accidental drop.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)