Tom Lane wrote:
>Dima Tkach <dmitry@openratings.com> writes:
>
>
>>I'd be happy to come up with a patch... It just was my understanding
>>that you would not accept such a patc hanyway, because your opinion is
>>that it is unnecessary and dangerous... Did I misunderstand you here?
>>
>>
>
>I don't see anything dangerous about it --- except perhaps to
>readability and mantainability of the code. The problem is that IS NULL
>doesn't fit into the operator-and-opclass model of what indexes can do.
>If you can find a solution to that problem that's not a complete kluge,
>I'm all ears.
>
> regards, tom lane
>
>
Well... At first glance, it seems that what needs to be done is:
- add a special case in is_indexable_operator() to return true for IS_NULL
- modify _bt_checkkeys () to return isNull from inside if
(key->sk_flags & SK_ISNULL) clause instead of just false.
- remove sk_flags & SK_ISNULL checks from _bt_orderkeys
Obviously, I haven't tested this, and I may very well have missed
something (I will, of course, inspect it and test thoroughly if you ok
the change in principle - just don't want to spend much time right now
on something, that may end up not being needed to anybody), but this
looks to me like pretty much it.
Dima