Re: Issue is changing _bt_compare function and

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: sandeep satpal <sandeep(at)it(dot)iitb(dot)ac(dot)in>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Issue is changing _bt_compare function and
Date: 2005-10-08 11:31:33
Message-ID: 20051008113132.GA30988@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 08, 2005 at 12:48:50PM +0530, sandeep satpal wrote:
> The _bt_compare function in "nbtree.c" file calls "FunctionCall2" and it
> passes two arguments , one is the scankey which we want to search on and
> other key is on current b-tree node.
>
> My problem is I want to pass three parameter and the third argument will
> be used for taking decision during comparision that whether I want
> case-sensitive comparision or case-insensitive.

Well, if you want to pass a third argument, go ahead. Just make sure
you update all the appropriate function calls.

> But "initdb" also uses the same _bt_compare function for creating its own
> indexes.
> For eg.
> when we write /usr/pgsql/bin/initdb -D /usr/local/data
> And my modification may create problems.
> How I solve this ??

Well, _bt_compare is used for every btree index in the system,
including all the system indexes. A fresh initdb already has several
dozen indexes already so your code has to deal with that.

Remember, _bt_compare compares strings, integers, floats, dates, etc
and your code needs to work for all of them too... What does it mean to
compare dates case-insensetivly?

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message mark 2005-10-08 13:31:06 Re: [HACKERS] A Better External Sort?
Previous Message Atsushi Ogawa 2005-10-08 09:15:10 Re: Reuse the dead item on unique index.