Add trigger and audit logging example to PostgreSQL advanced concepts#22
Merged
fahimahammed merged 2 commits intofahimahammed:mainfrom Oct 3, 2025
DivyanshGarg380:add-trigger-audit-example
Merged
Add trigger and audit logging example to PostgreSQL advanced concepts#22fahimahammed merged 2 commits intofahimahammed:mainfrom DivyanshGarg380:add-trigger-audit-example
fahimahammed merged 2 commits intofahimahammed:mainfrom
DivyanshGarg380:add-trigger-audit-example
Conversation
fahimahammed
approved these changes
Oct 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This PR enhances the Advanced Concepts in PostgreSQL documentation by adding a comprehensive example demonstrating how to create and use triggers for auditing database changes.
Changes included:
target_tableto demonstrate the trigger functionality.audit_tablethat logs all INSERT, UPDATE, and DELETE operations performed on the target table.event_type,event_time,table_name,old_data, andnew_data.log_changes)audit_table.to_jsonb()to store the row data in JSONB format for flexible querying.log_changestrigger function to thetarget_table.Benefits:
Usage:
Once merged, users can follow this example to implement audit logging for any table in their database.