Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Corin" <info(at)netskin(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition
Date: 2010-10-10 04:26:51
Message-ID: 2193.1286684811@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Corin" <info(at)netskin(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Netskin | Corin Langosch 2010-10-10 10:48:28 Re: BUG #5702: pg fails to use a conditional index even the where clause matches the condition
Previous Message Corin 2010-10-09 23:28:48 BUG #5702: pg fails to use a conditional index even the where clause matches the condition