Re: Correct syntax to create partial index on a boolean column

Поиск
Список
Период
Сортировка
От Mike Christensen
Тема Re: Correct syntax to create partial index on a boolean column
Дата
Msg-id CABs1bs3DJjtxBLayAw_8n8t2pUtVJj87Rer7TwhzR4xg=a8WLQ@mail.gmail.com
обсуждение исходный текст
Ответ на 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
Список 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 по дате отправления:

Предыдущее
От: Chris Angelico
Дата:
Сообщение: Re: Philosophical question
Следующее
От: Xiaobo Gu
Дата:
Сообщение: question about \encoding option of psql