V. Server Programming

This part is about extending the server functionality with user-defined functions, data types, triggers, etc. These are advanced topics which should probably be approached only after all the other user documentation about PostgreSQL has been understood. This part also describes the server-side programming languages available in the PostgreSQL distribution as well as general issues concerning server-side programming languages. This information is only useful to readers that have read at least the first few chapters of this part.

Table of Contents
33. Extending SQL
33.1. How Extensibility Works
33.2. The PostgreSQL Type System
33.3. User-Defined Functions
33.4. Query Language (SQL) Functions
33.5. Procedural Language Functions
33.6. Internal Functions
33.7. C-Language Functions
33.8. Function Overloading
33.9. Procedural Language Handlers
33.10. User-Defined Aggregates
33.11. User-Defined Types
33.12. User-defined Operators
33.13. Operator Optimization Information
33.14. Interfacing Extensions To Indexes
34. Index Cost Estimation Functions
35. The Rule System
35.1. The Query Tree
35.2. Views and the Rule System
35.3. Rules on INSERT, UPDATE, and DELETE
35.4. Rules and Privileges
35.5. Rules and Command Status
35.6. Rules versus Triggers
36. Triggers
36.1. Trigger Definition
36.2. Interaction with the Trigger Manager
36.3. Visibility of Data Changes
36.4. A Complete Example
37. Server Programming Interface
37.1. Interface Functions
37.2. Interface Support Functions
37.3. Memory Management
37.4. Visibility of Data Changes
37.5. Examples
38. Procedural Languages
38.1. Installing Procedural Languages
39. PL/pgSQL - SQL Procedural Language
39.1. Overview
39.2. Tips for Developing in PL/pgSQL
39.3. Structure of PL/pgSQL
39.4. Declarations
39.5. Expressions
39.6. Basic Statements
39.7. Control Structures
39.8. Cursors
39.9. Errors and Messages
39.10. Trigger Procedures
39.11. Porting from Oracle PL/SQL
40. PL/Tcl - Tcl Procedural Language
40.1. Overview
40.2. PL/Tcl Functions and Arguments
40.3. Data Values in PL/Tcl
40.4. Global Data in PL/Tcl
40.5. Database Access from PL/Tcl
40.6. Trigger Procedures in PL/Tcl
40.7. Modules and the unknown command
40.8. Tcl Procedure Names
41. PL/Perl - Perl Procedural Language
41.1. PL/Perl Functions and Arguments
41.2. Data Values in PL/Perl
41.3. Database Access from PL/Perl
41.4. Trusted and Untrusted PL/Perl
41.5. Missing Features
42. PL/Python - Python Procedural Language
42.1. PL/Python Functions
42.2. Trigger Functions
42.3. Database Access