Hacker News new | past | comments | ask | show | jobs | submit login

According to the manual [1], this is one of the standard use cases for partial indexes. See the last section.

CREATE UNIQUE INDEX index_name ON table_name (a, b) WHERE deleted_time IS NULL;

[1] http://www.postgresql.org/docs/9.1/static/indexes-partial.ht...




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: