Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition
Date
Msg-id 2193.1286684811@sss.pgh.pa.us
Whole thread Raw
In response to BUG #5702: pg fails to use a conditional index even the where clause matches the condition  ("Corin" <info@netskin.com>)
Responses Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition  (Netskin | Corin Langosch <clangosch@netskin.com>)
List pgsql-bugs
"Corin" <info@netskin.com> writes:
> CREATE INDEX fanobjects_amazon_product_id_index
>   ON fanobjects
>   USING btree
>   (amazon_product_id)
>   WHERE NOT amazon_product_id IS NULL;

Try it like

    WHERE amazon_product_id IS NOT NULL;

> I'd consider this a bug as "NOT x IS NULL" is the same as "x IS NOT NULL".

We don't expend an infinite number of cycles on rewriting different
query formulations into each other, and that's one of the ones we
don't handle ...

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Corin"
Date:
Subject: BUG #5702: pg fails to use a conditional index even the where clause matches the condition
Next
From: Netskin | Corin Langosch
Date:
Subject: Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition