Robert Haas <robertmhaas@gmail.com> writes:
> Forgive me if this is discussed before, but why does this store the
> strategy numbers of the relevant operators instead of the operators
> themselves? It seems like this could lead to surprising behavior if
> the user modifies the definition of the operator class.
Wild guess:
http://www.postgresql.org/docs/8.4/static/xindex.html
34.14.2. Index Method Strategies
The operators associated with an operator class are identified by "strategy numbers", which serve to identify the
semanticsof each operator within the context of its operator class. For example, B-trees impose a strict ordering on
keys,lesser to greater, and so operators like "less than" and "greater than or equal to" are interesting with respect
toa B-tree. Because PostgreSQL allows the user to define operators, PostgreSQL cannot look at the name of an operator
(e.g.,< or >=) and tell what kind of comparison it is. Instead, the index method defines a set of "strategies", which
canbe thought of as generalized operators. Each operator class specifies which actual operator corresponds to each
strategyfor a particular data type and interpretation of the index semantics.
Regards,
--
dim