Tom Lane wrote:
>The reason the spec defines these views this way is that it expects
>constraint names to be unique across a whole schema. We don't enforce
>that, and I don't think we want to start doing so (that was already
>proposed and shot down at least once). You are of course free to use
>constraint names that are distinct if you want to follow the spec's
>lead.
>
>
Would a good halfway house be to ensure that generated names were unique
within a schema (e.g. instead of generating "$1" generate
"tablename$1")? I know this might make looking to see if something is a
generated constraint mildly harder. It would have the advantage of a
slightly more meaningful name on the constraint.
Doing that we still wouldn't enforce the spec's requirements for
uniqueness of constraint names within a schema (which are arguably
silly), but wouldn't violate them ourselves.
(I'm sure there are wrinkles I haven't thought of, though. Not sure
about what it would do to backwards compatibility, for instance.)
cheers
andrew