Triggers and Stored Procedures in PostgreSQL

Triggers and stored procedures let you run logic inside the database, automatically on data changes or as callable routines.