Chapter 12. Creating Custom Functions

I l @ ve RuBoard

By itself, a database is nothing more than a container that holds data. The functions and tools are what make a database truly useful. Much of the work of designing an effective database is being able to model the business rules needed. Developing the proper table schema is one of the ways to model the business rules within the database; the other ways are through the creation of custom functions, triggers, and rules.

As a basic overview, functions, triggers, and rules compare as follows :

  • Functions. User-defined functions (also called stored procedures) are most useful as a way to implement commonly called code within the back end itself.

  • Triggers. These enable additional actions to be performed when a SELECT , INSERT , or UPDATESQL command is issued. These differ from rules in that they are called on a per-row basis.

  • Rules. Rules automatically rewrite supplied queries to perform substitute or additional actions when a SELECT , INSERT , or UPDATE command is issued. Rules differ from triggers in that rules are used when the actions affect other tables.

I l @ ve RuBoard


PostgreSQL Essential Reference
PostgreSQL Essential Reference
ISBN: 0735711216
EAN: 2147483647
Year: 2001
Pages: 118
Authors: Barry Stinson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net