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

From Mike Christensen
Subject Re: Correct syntax to create partial index on a boolean column
Date
Msg-id CABs1bs3DJjtxBLayAw_8n8t2pUtVJj87Rer7TwhzR4xg=a8WLQ@mail.gmail.com
Whole thread Raw
In response to Correct syntax to create partial index on a boolean column  (Mike Christensen <mike@kitchenpc.com>)
Responses Re: Correct syntax to create partial index on a boolean column
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!

FYI, I've posted this on StackOverflow too in case anyone wants to
score some points..

http://stackoverflow.com/questions/8514923/postgres-is-this-the-right-way-to-create-a-partial-index-on-a-boolean-column

I'm 90% sure this is the right way to do it though.

Mike

pgsql-general by date:

Previous
From: Chris Angelico
Date:
Subject: Re: Philosophical question
Next
From: Xiaobo Gu
Date:
Subject: question about \encoding option of psql