Skip site navigation (1) Skip section navigation (2)

Re: issue about information_schema REFERENTIAL_CONSTRAINTS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: issue about information_schema REFERENTIAL_CONSTRAINTS
Date: 2010-08-31 14:46:59
Message-ID: 2683.1283266019@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-docs
Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
> The REFERENTIAL_CONSTRAINTS table in the information_schema references a 
> constaint through its database/schema/name, but this information is not 
> unique, so it may identify several constraints, thus the information 
> derived may not be consistent.

Postgres does not enforce that constraints have unique names within a
schema.  The SQL spec does say that they should be unique per-schema,
and the information_schema views are designed on that assumption.

If you use spec-compliant names for your constraints, you won't have a
problem.  If you don't, well, the information_schema views will be of
limited use to you.

> Suggestion: constraint names could be systematically prefixed with their 
> corresponding table so that they are indeed unique,

We are not going to try to enforce uniqueness.  This has been debated
before, and most people like the current behavior just fine, or at least
better than the alternatives.

			regards, tom lane

In response to

Responses

pgsql-docs by date

Next:From: Thom BrownDate: 2010-08-31 16:09:12
Subject: Re: [pgsql-www] Example indenting
Previous:From: Fabien COELHODate: 2010-08-31 12:03:43
Subject: issue about information_schema REFERENTIAL_CONSTRAINTS

pgsql-bugs by date

Next:From: Dave PageDate: 2010-08-31 15:09:58
Subject: Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Previous:From: Cristian BittelDate: 2010-08-31 14:40:33
Subject: Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group