feat: remove trigger usage#4
Conversation
There was a problem hiding this comment.
Pull request overview
This PR transitions DDL guarding from using PostgreSQL event triggers to a ProcessUtility hook implementation. The change enables more direct interception of DDL commands and eliminates the need for the event trigger infrastructure.
Changes:
- Moved DDL detection logic from event trigger callback to ProcessUtility hook
- Updated log_sentinel_event to return bool instead of void for better error handling
- Added version 1.0.2 with migration script to drop the event trigger
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ddl_guard.control | Bumped version from 1.0.1 to 1.0.2 |
| ddl_guard.c | Added is_guarded_ddl_statement function, moved DDL guarding logic to ProcessUtility hook, changed log_sentinel_event signature to bool for graceful error handling |
| ddl_guard--1.0.2.sql | New installation script without event trigger creation |
| ddl_guard--1.0.1--1.0.2.sql | Migration script that drops the event trigger |
| Makefile | Added new SQL files to DATA list |
| README.md | Added upgrade instructions for version 1.0.2 |
| test/regular/sql/sentinel.sql | Combined SELECT and \gset into single line for cleaner output |
| test/regular/expected/sentinel.out | Updated expected output to match new test format |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| static bool | ||
| is_guarded_ddl_statement(Node *parsetree, CommandTag *commandTag) |
There was a problem hiding this comment.
The function is_guarded_ddl_statement is missing a forward declaration. For consistency with other static functions like is_guarded_dcl_statement (declared at line 45), this function should be declared in the forward declarations section near the top of the file.
This commit shifts us straight until the hook instead of using the event trigger.
This commit shifts us straight until the hook instead of using the event trigger.