Then it just happened to work out for me on Postgres, since a unique constraint is an index. Bad assumption.

Okay, so I'll refactor to treat constraints separately.