F.10. spi
- F.10.1. refint — Functions for Implementing Referential Integrity
- F.10.2. timetravel — Functions for Implementing Time Travel
- F.10.3. autoinc — Functions for Autoincrementing Fields
- F.10.4. insert_username — Functions for Tracking Who Changed a Table
- F.10.5. moddatetime — Functions for Tracking Last Modification Time
Thespi module provides several workable examples of using theServer Programming Interface (SPI) and triggers. While these functions are of some value in their own right, they are even more useful as examples to modify for your own purposes. The functions are general enough to be used with any table, but you have to specify table and field names (as described below) while creating a trigger.
Each of the groups of functions described below is provided as a separately-installable extension.
CREATE TABLE mytab ( ... ... start_date abstime, stop_date abstime ... ...);
A delete does not actually remove the tuple but only sets its stop_date to current time.
get_timetravel()
returns the TT state for a table without changing it.