Chapter 15. Interfacing Extensions To Indexes

In the Red Hat Database SQL Guide and Reference we described how to create a new type, new functions that operate on those types, and new operators. However, you could not yet define a secondary index (such as a B-tree, R-tree or hash access method) over a new type or its operators. This chapter describes how this could be accomplished. You will have to manually update the system catalogs, so we will begin with a brief review of the catalog structure. Please refer to Chapter 20 for more information about the Red Hat Database Catalogs.

About the Red Hat Database System Catalogs

First take a look at how the catalogs are laid out. You can skip this section for now, but some later sections may be incomprehensible without the information given here, so mark this page for later reference. All system catalogs have names that begin with pg_. The following tables contain information that may be useful to the end user. (There are many other system catalogs, but there should rarely be a reason to query them directly.)

Figure 15-1 shows the major entities and their relationships in the system catalogs. (Columns that do not refer to other entities are not shown unless they are part of a primary key.) This diagram is more or less incomprehensible until you actually start looking at the contents of the catalogs and see how they relate to each other. For now, the main things to observe in this diagram are:

Note

We use the words procedure and function more or less interchangeably throughout this chapter.