Indexing Custom Data Types
At this point, you have a reasonably complete custom data type. You can create and display FCUR values, store them in a table, compare two FCUR values, and convert them to (and from) other data types. But you're missing one important feature: You can't create an index that includes an FCUR value. Once you have all of the comparison operators (<, <=, =, >=, and so on) in place you are two short steps away.
To index values of a given data type, you must create an operator class that tells PostgreSQL which operators it should use for that type. You may recall from Chapter 3, “PostgreSQL Syntax and Use,” that PostgreSQL supports a number of index types (B-tree, hash, R-tree, and GiST). Each index type requires a different ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access