Chapter
focused on client-side programming--programs that run on the user's
computer and interact with the POSTGRESQL database. Server-side
functions, sometimes called stored procedures ,
run inside the database server rather than in the client application.
Several good uses for server-side functions exist. For example, if a function is used by many applications, it can be embedded into the database server. With this approach, each application no longer needs a copy of the function. Whenever the function is needed, the client can simply call it. Unlike client-side functions, server-side functions can be called within SQL queries. Also, functions centrally installed in the server are easily modified. When a function is changed, all client applications immediately start using the new version.
Table on page
lists many preinstalled server-side functions, like upper ()
and date_part (). This chapter shows how
to create your own functions. It also covers special server-side functions
called triggers, which are called automatically when a table is modified.