Some obvious things to code in C are logging, or auditing triggers, which get called at each
DELETE to a table. We have not set aside enough space in this book to explain everything needed for C triggers, but interested reader could look up the source code for the
skytools package where you can find more than one way to write triggers in C.
The highly optimized C source for the two main triggers,
logutriga, includes everything you need to capture these changes to a table and even detecting table structure changes while the code is running.
The latest source code for
skytools can be found at http://pgfoundry.org/projects/skytools.