Re: partial index on boolean, problem with v8.0.0rc1 - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: partial index on boolean, problem with v8.0.0rc1
Date
Msg-id 20041213185905.GA11248@wolff.to
Whole thread Raw
In response to partial index on boolean, problem with v8.0.0rc1  (Igor Shevchenko <igor@carcass.ath.cx>)
List pgsql-general
On Mon, Dec 13, 2004 at 20:18:57 +0200,
  Igor Shevchenko <igor@carcass.ath.cx> wrote:
>
> Here's the problem: in the 2nd case, planner wouldn't choose an index scan
> using partial index on "is_read" for the following queries:
>
> explain select * from user_msg where is_read=true;
> explain select * from user_msg where is_read is true;
> explain select * from user_msg where is_read;
>
> In the 1st case, partial index was used for the first query.

Note that whatever = TRUE is not equivalent to whatever IS TRUE.
The latter will return FALSE if whatever is NULL, while the former will return
NULL in that case.

There are also some limitations on the optimizer recognizing equivalent
varients of an expression. This might cause a problem with the third
select example.

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Substring question
Next
From: Tom Lane
Date:
Subject: Re: partial index on boolean, problem with v8.0.0rc1