Alban Hertroys <dalroi@solfertje.student.utwente.nl> writes:
> I defined a type:
> CREATE TYPE unit_token AS (
> base_unit TEXT,
> unit_base INT
> );
> If I try to join on tokens or try to create an index over that column
> I get: "ERROR: could not identify a comparison function for type
> unit_token".
As noted, there is a built-in solution as of 8.4.
> I have created operators on unit_token for =, <, <=, > and >=, but
> either I did something wrong defining my operators or the error is
> pointing to some other problem.
The mere fact that the operator is named '=' means nothing to Postgres.
You need to create an operator class or family that shows the operator
is equality in a btree opclass. Array comparison looks for the default
btree opclass for the element data type to decide what to do.
regards, tom lane