Martijn van Oosterhout <kleptog@svana.org> writes:
> This patch re-enables support for partial indices.
Applied, with some further changes by myself. Many thanks for tackling
this ancient TODO item!
A few comments for future reference:
1. Apparently you didn't run the regression tests; if you had, you'd
have found at least one more bug (transformIndexStmt was broken for
indexes generated implicitly by CREATE TABLE). The regression tests
are a good thing to use for backend code development.
2. I didn't like the way you did the SELECT of the partial index
expression in pg_dump; it'd break down the first time a quote mark
showed up in a relation name or compiled qual expression. What I
did instead was
SELECT pg_get_expr(indpred,indrelid) as pred FROM pg_index WHERE oid = %s
which required changing the second parameter of pg_get_expr from text to
oid --- but that's more robust anyway. The text version would've had
issues as soon as we implement schemas.
3. A needed feature not yet implemented is for psql's \d commands to
show the predicate when displaying info about a partial index.
regards, tom lane