table_log
record table modification logs and PITR for table/row
table_log : record table modification logs and PITR for table/row
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 5860 | table_log | table_log | 0.6.4 |
ADMIN | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | pgmemento pgaudit pg_drop_events data_historization table_version pgelog ddl_historization pgauditlogtofile pg_auditor pg_roast |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED | 0.6.4 |
18 17 16 15 14 | table_log |
- |
| RPM | PIGSTY | 0.6.4 |
18 17 16 15 14 | table_log_$v |
- |
| DEB | PGDG | 0.6.4 |
18 17 16 15 14 | postgresql-$v-tablelog |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 |
| el8.aarch64 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 |
| el9.x86_64 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 |
| el9.aarch64 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 |
| el10.x86_64 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 |
| el10.aarch64 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 | PIGSTY 0.6.4 |
| d12.x86_64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| d12.aarch64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| d13.x86_64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| d13.aarch64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| u22.x86_64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| u22.aarch64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| u24.x86_64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| u24.aarch64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| u26.x86_64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
| u26.aarch64 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 | PGDG 0.6.4 |
Source
github.com/df7cb/table_log
table_log-0.6.4.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
table_log: record table modification logs and PITR for table/row
The table_log extension records INSERT, UPDATE, and DELETE operations on a table into a separate log table, enabling point-in-time recovery at the table or row level.
Initialize Logging
Log Table Structure
The log table mirrors the original table columns plus metadata:
| Column | Description |
|---|---|
trigger_mode |
Operation type: INSERT, UPDATE, DELETE |
trigger_tuple |
Tuple version: ‘old’ or ’new’ |
trigger_changed |
Timestamp of the change |
trigger_id |
Sequential ID (level 4+) |
trigger_user |
User who made the change (level 5) |
Point-in-Time Restore
Trigger Functions
| Function | Description |
|---|---|
table_log() |
Full trigger function logging all columns |
table_log_basic() |
Basic trigger function with simpler logging |
table_log_restore_table(...) |
Restore table state to a given timestamp |