Re: Information Schema and constraint names not unique - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Information Schema and constraint names not unique
Date
Msg-id 3FAA6C3F.5030705@dunslane.net
Whole thread Raw
In response to Re: Information Schema and constraint names not unique  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Information Schema and constraint names not unique  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Very poor estimates from planner
Next
From: Tom Lane
Date:
Subject: Re: Information Schema and constraint names not unique