Some obvious things to code in C are logging or auditing triggers, which get called at each INSERT
, UPDATE
, or DELETE
to a table. We have not set aside enough space in this book to explain everything needed for C triggers, but interested readers can 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: logtriga
and logutriga
, includes everything you need to capture these changes to a table and also to detect table structure changes while the code is running.
The latest source code for skytools
can be found at http://pgfoundry.org/projects/skytools.