Chapter 17. Interfacing Extensions To Indexes

Table of Contents
17.1. Introduction
17.2. Access Methods
17.3. Access Method Strategies
17.4. Access Method Support Routines
17.5. Operator Classes
17.6. Creating the Operators and Support Routines

17.1. Introduction

The procedures described thus far let you define new types, new functions, and new operators. However, we cannot yet define a secondary index (such as a B-tree, R-tree, or hash access method) over a new type or its operators.

Look back at Figure 11-1. The right half shows the catalogs that we must modify in order to tell PostgreSQL how to use a user-defined type and/or user-defined operators with an index (i.e., pg_am, pg_amop, pg_amproc, pg_operator and pg_opclass). Unfortunately, there is no simple command to do this. We will demonstrate how to modify these catalogs through a running example: a new operator class for the B-tree access method that stores and sorts complex numbers in ascending absolute value order.