Supported Versions: Current (17) / 16 / 15 / 14 / 13
Development Versions: devel
Unsupported versions: 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

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. User-Defined Aggregates
33.10. User-Defined Types
33.11. User-Defined Operators
33.12. Operator Optimization Information
33.13. Interfacing Extensions To Indexes
34. The Rule System
34.1. The Query Tree
34.2. Views and the Rule System
34.3. Rules on INSERT, UPDATE, and DELETE
34.4. Rules and Privileges
34.5. Rules and Command Status
34.6. Rules versus Triggers
35. Triggers
35.1. Overview of Trigger Behavior
35.2. Visibility of Data Changes
35.3. Writing Trigger Functions in C
35.4. A Complete Example
36. Procedural Languages
36.1. Installing Procedural Languages
37. PL/pgSQL - SQL Procedural Language
37.1. Overview
37.2. Tips for Developing in PL/pgSQL
37.3. Structure of PL/pgSQL
37.4. Declarations
37.5. Expressions
37.6. Basic Statements
37.7. Control Structures
37.8. Cursors
37.9. Errors and Messages
37.10. Trigger Procedures
37.11. Porting from Oracle PL/SQL
38. PL/Tcl - Tcl Procedural Language
38.1. Overview
38.2. PL/Tcl Functions and Arguments
38.3. Data Values in PL/Tcl
38.4. Global Data in PL/Tcl
38.5. Database Access from PL/Tcl
38.6. Trigger Procedures in PL/Tcl
38.7. Modules and the unknown command
38.8. Tcl Procedure Names
39. PL/Perl - Perl Procedural Language
39.1. PL/Perl Functions and Arguments
39.2. Data Values in PL/Perl
39.3. Database Access from PL/Perl
39.4. Trusted and Untrusted PL/Perl
39.5. Missing Features
40. PL/Python - Python Procedural Language
40.1. PL/Python Functions
40.2. Trigger Functions
40.3. Database Access
41. Server Programming Interface
41.1. Interface Functions
41.2. Interface Support Functions
41.3. Memory Management
41.4. Visibility of Data Changes
41.5. Examples