Skip site navigation (1) Skip section navigation (2)

< operator for user-defined types

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: < operator for user-defined types
Date: 2004-03-25 14:44:39
Message-ID: 4062F057.6020705@sigaev.ru (view raw or flat)
Thread:
Lists: pgsql-hackers
I got several suggestions to include ordering operator for tsvector to aim 
grouping, union and except etc.

I wrote silly comparing function (byte to byte with some optimizations), but I 
wondered that for using operator < in order clause its need to declate B-tree 
opclass for type:

regression=# select  a from test_tsvector order by a;
ERROR:  could not identify an ordering operator for type tsvector
HINT:  Use an explicit ordering operator or modify the query.

I see in
backend/utils/cache/typcache.c near line 169:

         if ((flags & TYPECACHE_LT_OPR) && typentry->lt_opr == InvalidOid)
         {
                 if (typentry->btree_opc != InvalidOid)
                         typentry->lt_opr = 
get_opclass_member(typentry->btree_opc,InvalidOid, BTLessStrategyNumber);
         }

So, I must declare b-tree opclass for tsvector. Why?
My supposition is to guarantee that operator < is really 'less-than' one. Is it?




-- 
Teodor Sigaev                                  E-mail: teodor(at)sigaev(dot)ru

Responses

pgsql-hackers by date

Next:From: Marc G. FournierDate: 2004-03-25 15:02:03
Subject: Re: Email addresses on developer bios site
Previous:From: Andrew DunstanDate: 2004-03-25 14:37:30
Subject: Re: subversion vs cvs (Was: Re: linked list rewrite)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group