Chapter 37. Extending SQL

Table of Contents

37.1. How Extensibility Works
37.2. The PostgreSQL Type System
37.2.1. Base Types
37.2.2. Container Types
37.2.3. Domains
37.2.4. Pseudo-Types
37.2.5. Polymorphic Types
37.3. User-Defined Functions
37.4. User-Defined Procedures
37.5. Query Language (SQL) Functions
37.5.1. Arguments for SQL Functions
37.5.2. SQL Functions on Base Types
37.5.3. SQL Functions on Composite Types
37.5.4. SQL Functions with Output Parameters
37.5.5. SQL Functions with Variable Numbers of Arguments
37.5.6. SQL Functions with Default Values for Arguments
37.5.7. SQL Functions as Table Sources
37.5.8. SQL Functions Returning Sets
37.5.9. SQL Functions Returning TABLE
37.5.10. Polymorphic SQL Functions
37.5.11. SQL Functions with Collations
37.6. Function Overloading
37.7. Function Volatility Categories
37.8. Procedural Language Functions
37.9. Internal Functions
37.10. C-Language Functions
37.10.1. Dynamic Loading
37.10.2. Base Types in C-Language Functions
37.10.3. Version 1 Calling Conventions
37.10.4. Writing Code
37.10.5. Compiling and Linking Dynamically-Loaded Functions
37.10.6. Composite-Type Arguments
37.10.7. Returning Rows (Composite Types)
37.10.8. Returning Sets
37.10.9. Polymorphic Arguments and Return Types
37.10.10. Shared Memory and LWLocks
37.10.11. Using C++ for Extensibility
37.11. Function Optimization Information
37.12. User-Defined Aggregates
37.12.1. Moving-Aggregate Mode
37.12.2. Polymorphic and Variadic Aggregates
37.12.3. Ordered-Set Aggregates
37.12.4. Partial Aggregation
37.12.5. Support Functions for Aggregates
37.13. User-Defined Types
37.13.1. TOAST Considerations
37.14. User-Defined Operators
37.15. Operator Optimization Information
37.15.1. COMMUTATOR
37.15.2. NEGATOR
37.15.3. RESTRICT
37.15.4. JOIN
37.15.5. HASHES
37.15.6. MERGES
37.16. Interfacing Extensions to Indexes
37.16.1. Index Methods and Operator Classes
37.16.2. Index Method Strategies
37.16.3. Index Method Support Routines
37.16.4. An Example
37.16.5. Operator Classes and Operator Families
37.16.6. System Dependencies on Operator Classes
37.16.7. Ordering Operators
37.16.8. Special Features of Operator Classes
37.17. Packaging Related Objects into an Extension
37.17.1. Extension Files
37.17.2. Extension Relocatability
37.17.3. Extension Configuration Tables
37.17.4. Extension Updates
37.17.5. Installing Extensions Using Update Scripts
37.17.6. Security Considerations for Extensions
37.17.7. Extension Example
37.18. Extension Building Infrastructure

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