Supported Versions: Current (16) / 15 / 14 / 13 / 12
Development Versions: devel
Unsupported versions: 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 / 7.3 / 7.2 / 7.1
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.

Chapter 34. Extending SQL

Table of Contents
34.1. How Extensibility Works
34.2. The PostgreSQL Type System
34.2.1. Base Types
34.2.2. Composite Types
34.2.3. Domains
34.2.4. Pseudo-Types
34.2.5. Polymorphic Types
34.3. User-Defined Functions
34.4. Query Language (SQL) Functions
34.4.1. SQL Functions on Base Types
34.4.2. SQL Functions on Composite Types
34.4.3. Functions with Output Parameters
34.4.4. SQL Functions as Table Sources
34.4.5. SQL Functions Returning Sets
34.4.6. Polymorphic SQL Functions
34.5. Function Overloading
34.6. Function Volatility Categories
34.7. Procedural Language Functions
34.8. Internal Functions
34.9. C-Language Functions
34.9.1. Dynamic Loading
34.9.2. Base Types in C-Language Functions
34.9.3. Version 0 Calling Conventions
34.9.4. Version 1 Calling Conventions
34.9.5. Writing Code
34.9.6. Compiling and Linking Dynamically-Loaded Functions
34.9.7. Extension Building Infrastructure
34.9.8. Composite-Type Arguments
34.9.9. Returning Rows (Composite Types)
34.9.10. Returning Sets
34.9.11. Polymorphic Arguments and Return Types
34.9.12. Shared Memory and LWLocks
34.10. User-Defined Aggregates
34.11. User-Defined Types
34.12. User-Defined Operators
34.13. Operator Optimization Information
34.13.1. COMMUTATOR
34.13.2. NEGATOR
34.13.3. RESTRICT
34.13.4. JOIN
34.13.5. HASHES
34.13.6. MERGES
34.14. Interfacing Extensions To Indexes
34.14.1. Index Methods and Operator Classes
34.14.2. Index Method Strategies
34.14.3. Index Method Support Routines
34.14.4. An Example
34.14.5. Operator Classes and Operator Families
34.14.6. System Dependencies on Operator Classes
34.14.7. Special Features of Operator Classes

In the sections that follow, we will discuss how you can extend the PostgreSQL SQL query language by adding: