Re: < operator for user-defined types - Mailing list pgsql-hackers

From Tom Lane
Subject Re: < operator for user-defined types
Date
Msg-id 11453.1080228568@sss.pgh.pa.us
Whole thread Raw
In response to < operator for user-defined types  (Teodor Sigaev <teodor@sigaev.ru>)
List pgsql-hackers
Teodor Sigaev <teodor@sigaev.ru> writes:
> So, I must declare b-tree opclass for tsvector. Why?
> My supposition is to guarantee that operator < is really 'less-than'
> one. Is it?

Exactly.  We used to assume that any operator named '<' would be
suitable for sorting, but it's a lot safer to assume that an operator
associated with a b-tree opclass behaves in the right way.  Also there
are some optimizations possible as a result.  (It turns out that the
sorting code will end up using the comparison support function for the
opclass, and not the operator per se, because that way we only need one
function call per comparison.  Using the operator, we'd often need two
calls.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: Email addresses on developer bios site
Next
From: Josh Berkus
Date:
Subject: Re: pg_advisor schema proof of concept