Correct syntax to create partial index on a boolean column - Mailing list pgsql-general

From Mike Christensen
Subject Correct syntax to create partial index on a boolean column
Date
Msg-id CABs1bs1WkUXWq1W9EjZvL7aH2mtTK678C19SYXWFTPX9D8WVMA@mail.gmail.com
Whole thread Raw
Responses Re: Correct syntax to create partial index on a boolean column  (Mike Christensen <mike@kitchenpc.com>)
Re: Correct syntax to create partial index on a boolean column  (Alban Hertroys <haramrae@gmail.com>)
Re: Correct syntax to create partial index on a boolean column  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
List pgsql-general
For the boolean column Foo in Table1, if I want to index all values of
TRUE, is this syntax correct?

CREATE INDEX IDX_MyIndex ON Table1(Foo) WHERE Foo;

The query:

SELECT * FROM Table1 WHERE Foo;

should use the index, and:

SELECT * FROM Table1 WHERE NOT Foo;

should not, correct?

I just want to make sure I don't need an operator on the WHERE clause.  Thanks!

Mike

pgsql-general by date:

Previous
From: Darren Duncan
Date:
Subject: Re: Philosophical question
Next
From: Darren Duncan
Date:
Subject: Re: Philosophical question