Re: Why is NULL not indexable?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is NULL not indexable?
Date: 2001-06-27 00:06:23
Message-ID: 20010627100623.A10136@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 26, 2001 at 11:02:41AM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> > I can't work out what the 'strategy' bit refers to. All I can find in the
> > source code is references to tables of magic numbers. I guess what I really
> > want to know is, how hard would it be to fix?
>
> I believe the main problem is that IS NULL and IS NOT NULL are not
> operators (they don't have pg_operator entries), and all of the planning
> and indexscan execution machinery is designed around operators. Binary
> operators, at that.

Ok, I can see at least part of the problem now. You could make two operators
'is' and 'isnot' and have them equivalent to '=' and '!=' except in the case
of nulls. The index code is doing something like this anyway already.

> It's possible that this could be hacked around by creating dummy
> pg_operator entries for them, but my bet is that cleaning up the loose
> ends and no-longer-valid coding assumptions would be a nontrivial task.

Is there any documentation describing how this all works? I can't find
anything in the source code nor does anything appear in the mailing list
archives (maybe I'm searching for the wrong terms). All that stuff relating
to strategies (whatever they are) seems like it could do with some #defines
indicating what the numbers mean.

As a side note, the partial index stuff seems to be still perfectly fine in
the indexing code, you say it's the planner that doesn't handle it right?

Thanks for your time,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
- Artificial Intelligence is the science of making computers that behave
- like the ones in the movies.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Arnold 2001-06-27 00:56:16 Re: Capitalizing First Letter of Every Word
Previous Message Sergei Pohilko 2001-06-26 23:15:45 Cast varchar to interval in plpgsql