Re: Partial Indices vs. mixing columns and functions - Mailing list pgsql-general

From Tom Lane
Subject Re: Partial Indices vs. mixing columns and functions
Date
Msg-id 24966.995382613@sss.pgh.pa.us
Whole thread Raw
In response to Re: Partial Indices vs. mixing columns and functions  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Partial Indices vs. mixing columns and functions  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> I've been think about adding IS (NOT) NULL type clauses and it doesn't look
> too hard but I wonder if my logic is right.

I think all you need is to add the correct implication rules to
indxpath.c.  Let's see:

    IS NULL => IS NULL

    IS NOT NULL => IS NOT NULL

    IS TRUE => IS TRUE

    IS TRUE => IS NOT FALSE  (but not vice versa)

    IS TRUE => IS NOT UNKNOWN  (but not vice versa)

    IS NOT TRUE => IS NOT TRUE

and similarly to the last four for IS FALSE and IS UNKNOWN.  No?

BTW, it might be a good idea to split out the implication code into a
new file, probably in optimizer/prep or optimizer/utils, rather than
letting it continue to grow where it is.  Doesn't seem like it belongs
in indxpath.c.

            regards, tom lane

pgsql-general by date:

Previous
From: "Mitch Vincent"
Date:
Subject: Re: How to find out the weekday from a date???
Next
From: Tom Lane
Date:
Subject: Re: Partial Indices vs. mixing columns and functions