Supported Versions: Current (17) / 16 / 15 / 14 / 13
Development Versions: 18 / 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

Part 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. Later chapters in this part describe the server-side programming languages available in the PostgreSQL distribution as well as general issues concerning server-side programming languages. It is essential to read at least the earlier sections of Chapter 38 (covering functions) before diving into the material about server-side programming languages.

Table of Contents

38. Extending SQL
38.1. How Extensibility Works
38.2. The PostgreSQL Type System
38.3. User-Defined Functions
38.4. User-Defined Procedures
38.5. Query Language (SQL) Functions
38.6. Function Overloading
38.7. Function Volatility Categories
38.8. Procedural Language Functions
38.9. Internal Functions
38.10. C-Language Functions
38.11. Function Optimization Information
38.12. User-Defined Aggregates
38.13. User-Defined Types
38.14. User-Defined Operators
38.15. Operator Optimization Information
38.16. Interfacing Extensions to Indexes
38.17. Packaging Related Objects into an Extension
38.18. Extension Building Infrastructure
39. Triggers
39.1. Overview of Trigger Behavior
39.2. Visibility of Data Changes
39.3. Writing Trigger Functions in C
39.4. A Complete Trigger Example
40. Event Triggers
40.1. Overview of Event Trigger Behavior
40.2. Event Trigger Firing Matrix
40.3. Writing Event Trigger Functions in C
40.4. A Complete Event Trigger Example
40.5. A Table Rewrite Event Trigger Example
41. The Rule System
41.1. The Query Tree
41.2. Views and the Rule System
41.3. Materialized Views
41.4. Rules on INSERT, UPDATE, and DELETE
41.5. Rules and Privileges
41.6. Rules and Command Status
41.7. Rules Versus Triggers
42. Procedural Languages
42.1. Installing Procedural Languages
43. PL/pgSQLSQL Procedural Language
43.1. Overview
43.2. Structure of PL/pgSQL
43.3. Declarations
43.4. Expressions
43.5. Basic Statements
43.6. Control Structures
43.7. Cursors
43.8. Transaction Management
43.9. Errors and Messages
43.10. Trigger Functions
43.11. PL/pgSQL under the Hood
43.12. Tips for Developing in PL/pgSQL
43.13. Porting from Oracle PL/SQL
44. PL/Tcl — Tcl Procedural Language
44.1. Overview