Is it a common problem that duplicate constraints or indexes get created? I have seen this happen in different ways. You run scripts that you think are idempotent, but they are not really in this sense. (It's in the details:
CREATE TABLE foo (a REFERENCES b ...)
will fail cleanly when run twice. CREATE TABLE foo (a); ALTER TABLE foo ADD FOREIGN KEY ...
will not. See pg_dump.) Or logically duplicate things are created in independent ways, because say the psql \d
output isn't clear enough or isn't checked. Obviously, all of these are human errors in some way.I'm thinking that a setting to notify the user about this could be useful. It could be a warning or even an error. I can't see any possible reason in the normal course of use that someone would want two foreign keys that point exactly the same way, or two check constraints that check exactly the same thing, or two indexes that are set up in exactly the same way.
Comments? Experiences?