Re: Why is NULL not indexable? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Why is NULL not indexable?
Date
Msg-id 20010627100623.A10136@svana.org
Whole thread Raw
In response to Re: Why is NULL not indexable?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Why is NULL not indexable?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Tue, Jun 26, 2001 at 11:02:41AM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog@svana.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@svana.org>
http://svana.org/kleptog/
- Artificial Intelligence is the science of making computers that behave
- like the ones in the movies.

pgsql-general by date:

Previous
From: "Thalis A. Kalfigopoulos"
Date:
Subject: Re: Capitalizing First Letter of Every Word
Next
From: "Rob Arnold"
Date:
Subject: Re: Capitalizing First Letter of Every Word