Elements of PSQL
A PSQL module may contain declarations of local variables, subroutines and cursors, assignments, conditional statements, loops, statements for raising custom exceptions, error handling and sending messages (events) to client applications.DML triggers have access to special context variables, two “records” that store, respectively, the NEW
values for all columns during insert and update activity, and the OLD
values during update and delete work, and three Boolean variables — INSERTING
, UPDATING
and DELETING
— to determine the event that fired the trigger.
Statements that modify metadata (DDL) are not available in PSQL.