Re: < operator for user-defined types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: < operator for user-defined types
Date: 2004-03-25 15:29:28
Message-ID: 11453.1080228568@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)sigaev(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2004-03-25 16:15:06 Re: pg_advisor schema proof of concept
Previous Message Daniel Schuchardt 2004-03-25 15:15:55 Re: Delphi