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

Table of Contents

39. Extending SQL
39.1. How Extensibility Works
39.2. The Postgres Pro Type System
39.3. User-Defined Functions
39.4. User-Defined Procedures
39.5. Query Language (SQL) Functions
39.6. Function Overloading
39.7. Function Volatility Categories
39.8. Procedural Language Functions
39.9. Internal Functions
39.10. C-Language Functions
39.11. Function Optimization Information
39.12. User-Defined Aggregates
39.13. User-Defined Types
39.14. User-Defined Operators
39.15. Operator Optimization Information
39.16. Interfacing Extensions to Indexes
39.17. Packaging Related Objects into an Extension
39.18. Extension Building Infrastructure
40. Triggers
40.1. Overview of Trigger Behavior
40.2. Visibility of Data Changes
40.3. Writing Trigger Functions in C
40.4. A Complete Trigger Example
41. Event Triggers
41.1. Overview of Event Trigger Behavior
41.2. Event Trigger Firing Matrix
41.3. Writing Event Trigger Functions in C
41.4. A C language Event Trigger Example
41.5. A Table Rewrite Event Trigger Example
41.6. A Database Login Event Trigger Example
42. The Rule System
42.1. The Query Tree
42.2. Views and the Rule System
42.3. Materialized Views
42.4. Rules on INSERT, UPDATE, and DELETE
42.5. Rules and Privileges
42.6. Rules and Command Status
42.7. Rules Versus Triggers
43. Procedural Languages
43.1. Installing Procedural Languages
44. PL/pgSQLSQL Procedural Language
44.1. Overview
44.2. Structure of PL/pgSQL
44.3. Declarations
44.4. Expressions
44.5. Basic Statements
44.6. Control Structures
44.7. Cursors
44.8. Transaction Management
44.9. Errors and Messages
44.10. Trigger Functions
44.11. PL/pgSQL under the Hood
44.12. Tips for Developing in PL/pgSQL
44.13. Porting from Oracle PL/SQL
45. PL/Tcl — Tcl Procedural Language
45.1. Overview
45.2. PL/Tcl Functions and Arguments
45.3. Data Values in PL/Tcl
45.4. Global Data in PL/Tcl
45.5. Database Access from PL/Tcl
45.6. Trigger Functions in PL/Tcl
45.7. Event Trigger Functions in PL/Tcl
45.8. Error Handling in PL/Tcl
45.9. Explicit Subtransactions in PL/Tcl
45.10. Transaction Management
45.11. PL/Tcl Configuration
45.12. Tcl Procedure Names
46. PL/Perl — Perl Procedural Language
46.1. PL/Perl Functions and Arguments
46.2. Data Values in PL/Perl
46.3. Built-in Functions
46.4. Global Values in PL/Perl
46.5. Trusted and Untrusted PL/Perl
46.6. PL/Perl Triggers
46.7. PL/Perl Event Triggers
46.8. PL/Perl Under the Hood
47. PL/Python — Python Procedural Language
47.1. Python 2 vs. Python 3
47.2. PL/Python Functions
47.3. Data Values
47.4. Sharing Data
47.5. Anonymous Code Blocks
47.6. Trigger Functions
47.7. Database Access
47.8. Explicit Subtransactions
47.9. Transaction Management
47.10. Utility Functions
47.11. Environment Variables
48. Server Programming Interface
48.1. Interface Functions
48.2. Interface Support Functions
48.3. Memory Management
48.4. Transaction Management
48.5. Visibility of Data Changes
48.6. Examples
49. Background Worker Processes
50. Logical Decoding
50.1. Logical Decoding Examples
50.2. Logical Decoding Concepts
50.3. Streaming Replication Protocol Interface
50.4. Logical Decoding SQL Interface
50.5. System Catalogs Related to Logical Decoding
50.6. Logical Decoding Output Plugins
50.7. Logical Decoding Output Writers
50.8. Synchronous Replication Support for Logical Decoding
50.9. Streaming of Large Transactions for Logical Decoding
50.10. Two-phase Commit Support for Logical Decoding
51. Replication Progress Tracking