On Sat, 5 May 2001 richard@tortoise.demon.co.uk wrote:
PostgreSQL does have the functionality you are looking for. Try looking up triggers in the PostgreSQL manual. Are not triggers procedures that execute in response to an operation on a table? http://www.ca.postgresql.org/devel- corner/docs/postgres/triggers.html I mean procedures that can be called from a client, or from within another procedure, which would include, but is not limited to a trigger.
Yes - triggers are a mechanism for triggering calls to procedures whenever certain actions (e.g. SELECT, UPDATE, INSERT, DELETE) happen. You can use them to do things like consistency checks (trigger BEFORE an UPDATE or INSERT and flag an error if the check fails), creating audit trails (always add user names and timestamps to every record, or even create a separate transaction log if you want to), creating editable VIEWs, etc. Procedure creation and trigger creation is separate - you create the procedure first and then you can create a trigger that calls it if you want. You don't have to use triggers - they just seem to me to be the most obvious way to hook the procedures in, because you can then make almost everything invisible to the database client, giving you a 'clean' interface to the DB. Michael