Re: Issue is changing _bt_compare function and - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Issue is changing _bt_compare function and
Date
Msg-id 20051008113132.GA30988@svana.org
Whole thread Raw
In response to Re: Issue is changing _bt_compare function and  (sandeep satpal <sandeep@it.iitb.ac.in>)
Responses Re: Issue is changing _bt_compare function and
List 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@svana.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.

pgsql-hackers by date:

Previous
From: "Sean Utt"
Date:
Subject: pg_dump option to dump only functions
Next
From: "Magnus Hagander"
Date:
Subject: Re: Kerberos brokenness and oops question in 8.1beta2