PostgreSQL Triggers and Views 🐘
Today I learned a lot about PostgreSQL.
- Views can have triggers!
- Deleting such a view also deletes the trigger!
To demonstrate, let's create a table and record, and a view that looks at our table.
Now, we need a test function:
Let create a trigger for our function:
Here's our view... with a trigger attached!
Our trigger can be inspected (lots of interesting info omitted):
Drop the view, and lose the trigger:
Tweet