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.