Richard Huxton <dev@archonet.com> writes:
> The planner isn't smart enough to figure out which queries can use this
> index by examining them, it just looks for (NOT paid) in the WHERE
> clause and if it doesn't find it, ignores the index.
Well, it's a little bit brighter than that: it has some smarts about
btree-indexable comparisons and about null-testing. For instance, it
can figure out that "x > 3" implies "x > 0", and so a query WHERE x > 3
could use a partial index WHERE x > 0. Also, assuming that the >
operator is strict, it would recognize that WHERE x IS NOT NULL is
implied.
But there's certainly not anything in there that can make inferences
about regex matches.
regards, tom lane